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 wa?#include <iostream> using namespace std; int a[50]; int resultset[2000]; int main() { int i,j=0; int num,t; int mannum,cardnum; cin>>mannum>>cardnum; while (mannum!=0&&cardnum!=0) { bool* b=new bool [cardnum]; for (i=0;i<cardnum;i++) { b[i]=false; } int d1,d2; d1=mannum*cardnum; d2=d1-cardnum; for (i=0;i<cardnum;i++) { cin>>a[i]; } for (i=0;i<cardnum;i++) { if (a[i]>d2) { b[d1-a[i]]=true; } } i=0; num=0; t=0; while(i<cardnum) { if (t>=cardnum-i) break; if (b[i]) { if (t)t--; else num++; } else t++; i++; } resultset[j++]=num; cin>>mannum>>cardnum; } for (i=0;i<j;i++) { cout<<"Case "<<i+1<<": "<<resultset[i]<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator