z-javelin
Mr. Little Z decided to try himself as javelin thrower. He will try to throw the javelin N times. At each throw i he is speeding up until some moment t1i and for the next ti seconds he is running with a constant speed. After ti he is slowing down.
At each full second (integer value of seconds) in the interval [ t1i, t1i + ti ] he can throw the javelin. Javelin thrown at the moment t1i + t will fall at the position t1i + t * ki, 0 <= t <= ti.
Making N throws, Mr. Little Z wonders what is the number of possible different positions that could be hit during these tries. Hitting position pos at try i and try j counts as only one unique position pos.
2
7 4 5
10 7 2Output:
11Explanation:
In the first try Mister Little Z could have hit the following positions:
7 + 0*5 = 7
7 + 1*5 = 12
7 + 2*5 = 17
7 + 3*5 = 22
7 + 4*5 = 27
And in the second try he could have hit:
10 + 0*2 = 10
10 + 1*2 = 12
10 + 2*2 = 14
10 + 3*2 = 16
10 + 4*2 = 18
10 + 5*2 = 20
10 + 6*2 = 22
10 + 7*2 = 24
So there are 11 unique possible positions: 7, 10, 12, 14, 16, 17, 18, 20, 22, 24, and 27
Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.