RingImposition
SRM 274 · 2005-11-23 · by Andrew_Lazarev
Problem Statement
Numbers from the sequence seq are placed around a circle in order. During an imposition operation, each number becomes the sum of itself and the next number in order, modulo 100 (i.e., if the sum is greater than or equal to 100, 100 is subtracted from it). The last number in the sequence is summed with the first one, modulo 100.
You will be given a
Constraints
- seq will have between 2 and 50 elements, inclusive.
- Each element of seq will be between 0 and 99, inclusive.
- N will be between 1 and 2000000000, inclusive.
{1, 2, 3}
2
Returns: {8, 9, 7 }
After the first imposition operation the sequence become {1+2, 2+3, 3+1} or {3, 5, 4}. After the second imposition operation the sequence become {3+5, 5+4, 4+3} or {8, 9, 7}.
{25, 0, 0, 0}
12
Returns: {0, 0, 0, 0 }
{3, 15, 7, 1, 16}
5
Returns: {41, 50, 84, 97, 72 }
The sequence transformation is {3, 15, 7, 1, 16} -> {18, 22, 8, 17, 19} -> {40, 30, 25, 36, 37} -> {70, 55, 61, 73, 77} -> {25, 16, 34, 50, 47} -> {41, 50, 84, 97, 72}
{3, 15, 7, 1, 16, 1, 72}
192347
Returns: {88, 72, 62, 55, 11, 11, 21 }
{0, 0}
2000000000
Returns: {0, 0 }
Submissions are judged against all 73 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class RingImposition with a public method vector<int> predict(vector<int> seq, int N) · 73 test cases · 2 s / 256 MB per case