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

这么快的东西怎么提交还错?嫌我时间用的少?

Posted by sunnvya at 2006-09-21 11:37:33 on Problem 2524
思路很清晰,测试数据都真确,怎么就错?
#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:
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