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

这道题怎么总是wa?

Posted by sunmoonstar_love at 2005-05-31 14:29:28 on Problem 2443
#include <stdio.h>
#include <math.h>
int main()
{
    int N,i,j,c[10001][32],tmp,a,b; 
    scanf("%d",&N);
    for(i=1; i<=10000; i++)
        for(j=0; j<32; j++)
            c[i][j] = 0;    
    for(i=1; i<=N; i++)
    {
        scanf("%d",&j);
        while(j--)
        {
            scanf("%d",&tmp);
            a = int(pow(2,i%32-1));
            if((c[tmp][i/32]&a) == 0)
                c[tmp][i/32] += a;
        }    
    }
    scanf("%d",&N);
    while(N--)
    {
        scanf("%d %d",&a,&b);
        tmp = 0;
        for(i=0; i<32&&tmp==0; i++)
            tmp = c[a][i] & c[b][i];                 
        if(tmp!=0)
            printf("Yes\n");
        else
            printf("No\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