| ||||||||||
| 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 | |||||||||
到底哪里错了啊 求高手帮忙看看#include <algorithm>
using namespace std;
bool num[1010];
int num1[110];
int main(){
int m,n,k,count,j,s=0,count1;
while(scanf("%d%d",&m,&n) &&(m+n))
{
s++;
memset (num,false,sizeof(num));
num[0]=true;
for(int i=0;i<n;i++)
{
scanf("%d",&num1[i]);
num[num1[i]]=true;
}
sort(num1,num1+n);
count1=0;
for(i=0;i<n;i++)
{
count=0;
k=num1[i];
int k1=k+1;
while(k1<=m*n)
{
if(num[k1]==false)
{
num[k1]=true;
count++;
count1++;
break;
}
k1++;
}
j=0;
for(int p=0;p<=m*n;p++)
{
if(num[p]==false)
{
num[p]=true;
j++;
}
if(j==m-1-count)
break;
}
}
printf("Case %d: %d\n",s,n-count1);
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator