#2623. 实验日志

实验日志

Description

小爱正在完成一个物理实验,为期<math xmlns="http://www.w3.org/1998/Math/MathML">n天,其中第<math xmlns="http://www.w3.org/1998/Math/MathML">i天,小爱会记录<math xmlns="http://www.w3.org/1998/Math/MathML">ai条实验数据在实验日志中。

已知小爱的实验日志每一页最多纪录<math xmlns="http://www.w3.org/1998/Math/MathML">m条数据,每天做完实验后他都会将日志合上,第二天,他便从第一页开始依次翻页,直到找到第一个有空白位置的页码为止,开始新一天的数据记录。

请问在整个实验过程中,小爱每天为了找到第一个空白位置,需要翻多少页?

Input Format

输入共两行
第一行,两个正整数<math xmlns="http://www.w3.org/1998/Math/MathML">n,m
第二行,<math xmlns="http://www.w3.org/1998/Math/MathML">n个正整数,表示每天的数据条数。

Output Format

输出共一行,<math xmlns="http://www.w3.org/1998/Math/MathML">n个正整数,分别表示每一天开始实验前,需要翻的页数。
4 10
7 8 5 12
0 0 1 2

Hint

说明:

第一天不用翻页
第二天开始前,由于只记了7条,仍是从第一页开始,不用翻页
第三天开始前,共记录了15条,则是从第二页开始,需翻1页
第四天开始前,共记录了20条,由于第二页已写满,则是从第三页开始,需翻2页

  • 对于 <math xmlns="http://www.w3.org/1998/Math/MathML">30% 的数据,<math xmlns="http://www.w3.org/1998/Math/MathML">1n100
  • 对于 <math xmlns="http://www.w3.org/1998/Math/MathML">60% 的数据,<math xmlns="http://www.w3.org/1998/Math/MathML">1n104
  • 对于 <math xmlns="http://www.w3.org/1998/Math/MathML">100% 的数据,<math xmlns="http://www.w3.org/1998/Math/MathML">1n105
  • <math xmlns="http://www.w3.org/1998/Math/MathML">1m,ai104


Source

循环语句 上海市2023年1月赛