#1012. 小杨的储蓄
小杨的储蓄
说明
小杨共有 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>N 个储蓄罐,编号从 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0</mn></mrow></semantics></math>0 到 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi><mo>−</mo><mn>1</mn></mrow></semantics></math>N−1。从第 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn></mrow></semantics></math>1 天开始,小杨每天都会往存钱罐里存钱。具体来说,第 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>i 天他会挑选一个存钱罐 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>�</mi><mi>�</mi></msub></mrow></semantics></math>ai,并存入 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>i 元钱。过了 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>D 天后,他已经忘记每个储蓄罐里都存了多少钱了,你能帮帮他吗?
输入格式
输入 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>2</mn></mrow></semantics></math>2 行,第一行两个整数 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi><mo separator="true">,</mo><mi>�</mi></mrow></semantics></math>N,D;第二行 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>D 个整数,其中第 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>i 个整数为 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>�</mi><mi>�</mi></msub></mrow></semantics></math>ai(保证 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0</mn><mo>≤</mo><msub><mi>�</mi><mi>�</mi></msub><mo>≤</mo><mi>�</mi><mo>−</mo><mn>1</mn></mrow></semantics></math>0≤ai≤N−1)。
每行的各个整数之间用单个空格分隔。
保证 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mo>≤</mo><mi>�</mi><mo>≤</mo><mn>1</mn><mo separator="true">,</mo><mn>000</mn></mrow></semantics></math>1≤N≤1,000;<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mo>≤</mo><mi>�</mi><mo>≤</mo><mn>1</mn><mo separator="true">,</mo><mn>000</mn></mrow></semantics></math>1≤D≤1,000。
<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn></mn><mo></mo><mi></mi><mo></mo><mn></mn><mo separator="true"></mo><mn></mn></mrow></semantics></math><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn></mn><mo></mo><mi></mi><mo></mo><mn></mn><mo separator="true"></mo><mn></mn></mrow></semantics></math>
输出格式
输出 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>N 个用单个空格隔开的整数,其中第 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>i 个整数表示编号为 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi><mo>−</mo><mn>1</mn></mrow></semantics></math>i−1 的存钱罐中有多少钱(<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi><mo>=</mo><mn>1</mn><mo separator="true">,</mo><mo>⋯</mo><mtext> </mtext><mo separator="true">,</mo><mi>�</mi></mrow></semantics></math>i=1,⋯,N)。
样例
2 3
0 1 0
4 2
相关
在以下作业中: