| ||||||||||
| 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<stdio.h>
#include<string.h>
using namespace std;
int a[50001];
int main()
{
long long n,m,i,j,k,count;
int c=0;
while(scanf("%d %d",&n,&m)!=EOF&&n!=0&&m!=0)
{ memset(a,0,50001);
count=0;
for (k=0;k<m;k++)
{
scanf("%d %d",&i,&j);
if(a[i]==0||a[j]==0){count++;a[i]=1;a[j]=1;}//数据用过后就变1,当2个都是1就是都用过,
//那就不用加count
}
printf("Case %d: %d\n",++c,n-count);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator