#abc281c. C - Circular Playlist
C - Circular Playlist
Score : points
问题陈述
我们有一个包含 首歌曲的播放列表,编号为 。
第 首歌曲持续时间为 秒。
当播放列表播放时,按照歌曲 , 歌曲 , , 歌曲 的顺序依次播放。当歌曲 结束时,播放列表会从歌曲 开始重新循环播放。在一首歌曲播放期间,下一首歌曲不会播放;当一首歌曲结束时,下一首歌曲会立即开始播放。
在播放列表开始播放后恰好 秒时,正在播放的是哪首歌?同时,从该歌曲开始播放起已经过去了多少秒?
没有输入情况会在播放列表开始播放后恰好 秒时切换歌曲。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
We have a playlist with songs numbered .
Song lasts seconds.
When the playlist is played, song , song , , and song play in this order. When song ends, the playlist repeats itself, starting from song again. While a song is playing, the next song does not play; when a song ends, the next song starts immediately.
At exactly seconds after the playlist starts playing, which song is playing? Also, how many seconds have passed since the start of that song?
There is no input where the playlist changes songs at exactly seconds after it starts playing.
Constraints
- The playlist does not change songs at exactly seconds after it starts playing.
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print an integer representing the song that is playing at exactly seconds after the playlist starts playing, and an integer representing the number of seconds that have passed since the start of that song, separated by a space.
Sample Input 1
3 600
180 240 120
Sample Output 1
1 60
When the playlist is played, the following happens. (Assume that it starts playing at time .)
- From time to time , song plays.
- From time to time , song plays.
- From time to time , song plays.
- From time to time , song plays.
- From time to time , song plays.
At time , song is playing, and seconds have passed since the start of that song.
Sample Input 2
3 281
94 94 94
Sample Output 2
3 93
Sample Input 3
10 5678912340
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000
Sample Output 3
6 678912340
update @ 2024/3/10 11:48:12