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

Re:求助,实在是找不到错了

Posted by www619471234 at 2010-08-07 17:02:25 on Problem 1975
In Reply To:求助,实在是找不到错了 Posted by:liuwenjiedemajia at 2010-07-27 18:34:05
> #include <stdio.h>
> #include <string.h>
> #define maxn 130
> int n,m,map[maxn][maxn];
> int main(void)
> {
>     int T,kk,t1,t2,i,j,k,temp,temp2,count;
>     scanf("%d\n",&T);
>     for (kk=1;kk<=T;kk++){
>         count=0;
>         memset(map,0,sizeof(map));
>         scanf("%d %d\n",&n,&m);
>         for (i=1;i<=m;i++){
>             scanf("%d %d\n",&t1,&t2);
>             map[t1][t2]=1;
>         }
>         for (i=1;i<=n;i++)
>             for (j=1;j<=n;j++)
>                 for (k=1;k<=n;k++)
>                     map[i][j]|=(map[i][k]&map[k][j]);
>                     
>         for (i=1;i<=n;i++){
>             temp=0;temp2=0;
>             for (j=1;j<=n;j++)
>                 if (map[i][j]) temp++;
>             for (j=1;j<=n;j++)    
>                 if (map[j][i]) temp2++;
>             if (((temp+1)>(n+1)/2)||((temp2+1)>(n+1)/2)) count++;
>         }
>         printf("%d\n",count);        
>     }
>     return 0;    
> }
Floyd写错了  那三重循环

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