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 |
新手求救!不知为什么WA#include <iostream> #include <algorithm> #include <string> #include <stdlib.h> #include <math.h> using namespace std; main() { int card_num,person_num,card[60],count2,sum,count,i,bigcard; count=0; while(scanf("%d%d",&person_num,&card_num)&&card_num!=0&&person_num!=0) { count++; for(i=0;i<card_num;i++) { scanf("%d",&card[i]); } sort(card,&card[card_num]); sum=person_num*card_num; count2=0; for(i=card_num-1;i>0;i--) { bigcard=sum-card[i]-(card_num-i-1); if(bigcard<=0) count2++; else sum--; } printf("Case %d: %d\n",count,count2); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator