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> using namespace std; int cmp(int a,int b) { return a>b; } int main() { int i,j=0,max,n,m,a[2000],cx=0; while(cin>>n>>m) { memset(a,0,sizeof(a)); if(n==0&&m==0) break; j++; max=n*m; for(i=0;i<m;i++) cin>>a[i]; sort(a,a+m,cmp); for(i=0;i<m;i++) { if(max==a[i]||(max-2)==a[i+1]) cx++; max--; } cout<<"Case "<<j<<": "<<cx; cx=0;cout<<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