Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Why Wrong ! Give me a reason !!!! What data!?#include "iostream" using namespace std; char order[11]; int Qnum[1001][2]; int minimum(const void * a,const void * b) { int *c=(int *)a; int *d=(int *)b; if(c[1]!=d[1]) return c[1]-d[1]; else return c[0]-d[0]; } int main () { int i,j,k; int num,m; int temp; //freopen("in.txt","r",stdin); for(num=0;;) { scanf("%s",order); if(order[0]=='#') break; if(strcmp(order,"Register")==0) { scanf("%d%d",&Qnum[num][0],&Qnum[num][1]); //Qnum[num][2]=num; num++; } } temp=sizeof(Qnum[0]); qsort(Qnum,num,sizeof(Qnum[0]),minimum); scanf("%d",&m); for(i=1,j=0;j<m;i++) { if(j>=m) break; for(k=0;k<num;k++) if(i%Qnum[k][1]==0) { printf("%d\n",Qnum[k][0]); j++; if(j>=m) break; } } return 1; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator