Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

上机测试表示通过 但还是WA 好多次了 求大神帮助!!!!

Posted by pdjlzs at 2011-05-19 13:12:04 on Problem 1323
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator