#abc322c. C - Festival
C - Festival
Score : points
问题描述
AtCoder王国举行了一个持续 天的节日。在这其中的 天,即第 天、第 天、……、第 天将会燃放烟花。保证在节日的最后一天一定会燃放烟花。(换句话说,可以确保 。)
对于每个 ,解决以下问题:
- 从第 天开始算起,首次在第 天或之后燃放烟花需要等待多少天?如果在第 天就燃放了烟花,则视为等待 天。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
The AtCoder Kingdom holds a festival for days. On of these days, namely on the -th, -th, , -th days, fireworks will be launched. It is guaranteed that fireworks will be launched on the last day of the festival. (In other words, is guaranteed.)
For each , solve the following problem.
- How many days later from the -th day will fireworks be launched for the first time on or after the -th day? If fireworks are launched on the -th day, it is considered to be days later.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print lines.
The -th line should contain an integer representing the number of days from the -th day until fireworks are launched for the first time on or after the -th day.
Sample Input 1
3 2
2 3
Sample Output 1
1
0
0
The kingdom holds a festival for days, and fireworks are launched on the -nd and -rd days.
- From the -st day, the first time fireworks are launched is the -nd day of the festival, which is day later.
- From the -nd day, the first time fireworks are launched is the -nd day of the festival, which is days later.
- From the -rd day, the first time fireworks are launched is the -rd day of the festival, which is days later.
Sample Input 2
8 5
1 3 4 7 8
Sample Output 2
0
1
0
0
2
1
0
0
update @ 2024/3/10 01:42:21