POJ - 3665 iCow(模拟)】的更多相关文章

题意:有N首歌曲,播放的顺序按照一定的规则,输出前T首被播放的歌的编号.规则如下: 1.每首歌有一个初始的等级r,每次都会播放当前所有歌曲中r最大的那首歌(若r最大的有多首,则播放编号最小的那首歌). 2.当某首歌被播放完后,它的等级r会变成0,而且它的r会被均分到其他N-1首歌里,若均分后还有剩余,则将剩余的将会分给剩下N-1首歌.(按照这N-1首歌编号从小到大的顺序,每首歌分1个) 3.每播放完一首歌都会执行一遍条件2. 分析:注意N=1时特判,否则除数不能为0. #pragma comme…
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…
按照题意模拟就OK了 //By SiriusRen #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int n,t,a[1005]; int main() { scanf("%d%d",&n,&t); for(int i=1;i<=n;i++){ scanf("%d",&a[i]); } fo…
转载请注明出处:viewmode=contents">http://blog.csdn.net/u012860063? viewmode=contents 题目链接:http://poj.org/problem? id=3077 Description For a given number, if greater than ten, round it to the nearest ten, then (if that result is greater than 100) take the…
http://poj.org/problem?id=1068 #include<cstdio> #include <cstring> using namespace std; int ind[45]; bool used[45]; int r[21]; int l[21]; int len,n,llen; int w[21]; int main(){ int t; scanf("%d",&t); while(t--){ memset(used,0,siz…
水题,主要是思路清晰,判断明确. 记x为A站最前方的车,y表示下一列要进入B站的车厢,初识时,x=1;y=a1;C=[]; 在调度过程中: if(y==0)那么调度成功,退出模拟过程:否则 if(x==y)就是说接下来进站的正好是要出去的,那就直接让它A—>B 否则 if(C不空 && y=(最后进入C的火车)) 让车从C开出进入B  否则 if(x!=0)那么车 A—>C 否则  无解 #include<cstdio> #include<cstring>…
模拟小数幂 小数点位 pos 非零末位 e 长度 len 只有三种情况 pos > len pos < e e < pos < len #include <iostream> #include <cstring> using namespace std; ], b[], c[]; void Cal() { memset(c, , sizeof(c)); ; i < ; i++) ; j < ; j++) c[i+j] += a[i] * b[j]…
e.... 虽然这是一道灰常简单的模拟题.但是米做的时候没有读懂第二个日历的计时方法.然后捏.敲完之后华丽的WA了进一个点.坑点就在一年的最后一天你是该输出本年的.e ...但是我好想并没有..看discuss里好想被坑的人还不少.总天数能直接整除260的时候.年数要减1. 不喜欢做模拟.....5555.... 附代码: #include<stdio.h>#include<string.h>#include<iostream>#include<string>…
Description In a modernized warehouse, robots are used to fetch the goods. Careful planning is needed to ensure that the robots reach their destinations without crashing into each other. Of course, all warehouses are rectangular, and all robots occup…
Manhattan 2025 Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 1318   Accepted: 703 Description Background Manhattan in the year 2025 - it is so densely populated that its old two-dimensional grid of streets and avenues fails to provide…