CF1968C Assembly via Remainders
Description
You are given an array $ x_2,x_3,\dots,x_n $ . Your task is to find any array $ a_1,\dots,a_n $ , where:
- $ 1\le a_i\le 10^9 $ for all $ 1\le i\le n $ .
- $ x_i=a_i \bmod a_{i-1} $ for all $ 2\le i\le n $ .
Here $ c\bmod d $ denotes the remainder of the division of the integer $ c $ by the integer $ d $ . For example $ 5 \bmod 2 = 1 $ , $ 72 \bmod 3 = 0 $ , $ 143 \bmod 14 = 3 $ .
Note that if there is more than one $ a $ which satisfies the statement, you are allowed to find any.
Input Format
N/A
Output Format
N/A
Explanation/Hint
In the first test case $ a=[3,5,4,9] $ satisfies the conditions, because:
- $ a_2\bmod a_1=5\bmod 3=2=x_2 $ ;
- $ a_3\bmod a_2=4\bmod 5=4=x_3 $ ;
- $ a_4\bmod a_3=9\bmod 4=1=x_4 $ ;