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 birdo0o at 2008-04-11 16:22:03 on Problem 1029
#include<stdio.h>
int main() {
    int n,k;
    int p,s[1001];
    int used[1001]={0};
    int i,j,t,position,num;
    char ch;
    scanf("%d %d",&n,&k);
    t=0;
    for (i=1;i<=k;i++){
        scanf("%d",&p);
        for (j=1;j<=2*p;j++) scanf("%d",&s[j]);
        scanf("%1s",&ch);
        if (ch=='=') 
           for (j=1;j<=2*p;j++) used[s[j]]--;
        else {             
             for (j=1;j<=2*p;j++) used[s[j]]++;
             t++;                 
             }      
        }
    num=0;
    for (i=1;i<=n;i++)
        if (used[i]==t) {
           position=i;
           num++;
           }
    if(num==1) printf("%d\n",position);
    else printf("0\n");       
      
    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