Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

翻译

Posted by zerocpp at 2011-05-16 16:17:23 on Problem 3665
Poj 3665 iCow
iCow
Fatigued by the endless toils of farming, Farmer John has decided to try his hand in the MP3 player market with the new iCow. It is an MP3 player that stores N songs (1 ≤ N ≤ 1,000) indexed 1 through N that plays songs in a "shuffled" order, as determined by Farmer John's own algorithm:
•	Each song i has an initial rating Ri (1 ≤ Ri ≤ 10,000).
•	The next song to be played is always the one with the highest rating (or, if two or more are tied, the highest rated song with the lowest index is chosen).
•	After being played, a song's rating is set to zero, and its rating points are distributed evenly among the other N-1 songs.
•	If the rating points cannot be distributed evenly (i.e., they are not divisible by N-1), then the extra points are parceled out one at a time to the first songs on the list (i.e., R1 , R2 , etc. -- but not the played song) until no more extra points remain.
This process is repeated with the new ratings after the next song is played.
Determine the first T songs (1 ≤ T ≤ 1000) that are played by the iCow.
有一款MP3,叫iCow,里面存储了N(1<=N<=1000)首歌曲,随机播放顺序由以下算法决定。
•	每首歌i有一个初始的Ri(1<=Ri<=10000)
•	下首歌总是最高的Ri(如果Ri==Rj && i<j,则选i)
•	一首歌i播放之后,这首歌的Ri=0,并且将这首歌原来的Ri分给其他N-1首歌
•	若Ri不能被N-1整除,则多出的部分Ri%(N-1)将从第1首歌开始一首歌1点(播放的这首歌除外),直到没有多余的点数
每首歌播放完毕都执行以上算法更新Ri
请决定先被播放的T(1<=T<=1000)首歌曲。

输入:
* Line 1: Two space-separated integers: N and T
* Lines 2..N+1: Line i+1 contains a single integer: Ri
第一行:两个整数N T
第2~N+1行:Ri

输出:
* Lines 1..T: Line i contains a single integer that is the i-th song that the iCow plays.
1~T行:被播放的序号

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator