Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
求助,实在是找不到错了#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; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator