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

why I am wa

Posted by ecjtuxiongbp at 2005-10-29 19:11:41 on Problem 2524
#include<stdio.h>
int main()
{
	int i,j,k,cas,num;
	long m,n,l;
	cas=0;
	while(1)
	{
		scanf("%ld%ld",&n,&m);
		cas++;
		if(n==0&&m==0)break;
		int a[50001]={0};
		num=0;
		for(l=1;l<=m;l++)
		{
			scanf("%d%d",&i,&j);
			if(a[i]==0&&a[j]==0)
			{
				num++;
				
			}
		 
		  	a[i]=1;  a[j]=1;
			
		}
		for(i=1;i<=n;i++)if(a[i]==0)num++;
        printf("Case %d: %d\n",cas,num);
	}
	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