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 wrong answer!!!!!???????????

Posted by fxlbest at 2005-10-08 21:19:59 on Problem 2524
#include <iostream>
using namespace std;
  
int main() {
    int i;
    int n,m;
    int num;
    int p,q;
    int temp,temq;
    int notalone;
    int r=0;
    while(1){
        scanf("%d%d",&n,&m);
        if(n==0 && m==0)break;
        int stu[50001]={0};
        num=0;notalone=0;
        for(i=0;i<m;i++){
            scanf("%d%d",&p,&q);
            temp=stu[p];temq=stu[q];
            if(temp==0 && temq==0){
                ++num;
                stu[p]=1;
                stu[q]=1;
                notalone=notalone+2;
                continue;
            }
            if(temp==0 || temq==0) {
                stu[p]=1;
                stu[q]=1;
                notalone++;
            }         
        }
        num=num+n-notalone;
        ++r;
        printf("Case %d: %d\n",r,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