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 "iostream" using namespace std; int _tmain(int argc, _TCHAR* argv[]) { int A[150][150],B[10000],i,j,k,s,time,maxt,maxn; int n,limit; while(1) { cin>>n; if(n==0) break; for(i=1;i<=n;i++) for(j=1;j<=n;j++) A[i][j]=1000000; for(i=1;i<=n;i++) { cin>>B[i]; for(j=1;j<=B[i];j++) { cin>>k>>time; A[i][k]=time; } } for(s=1;s<=n;s++) for(i=1;i<=n;i++) for(j=1;j<=n;j++) if(A[i][s]+A[s][j]<A[i][j]) A[i][j]=A[i][s]+A[s][j]; limit=1000000; for(i=1;i<=n;i++) { A[i][i]=0; maxt=0; for(j=1;j<=n;j++) if(maxt<A[i][j]) maxt=A[i][j]; if(limit>maxt) { limit=maxt; maxn=i; } } if(limit==1000000) cout<<"disjoint"<<endl; else cout<<maxn<<" "<<limit<<endl; } return 0; } 问题出在limit赋值的地方,如果是在定义的时候赋值,就WA,在上面代码所示的地方赋值就AC,百思不得其解啊,我试了n次,不知道问什么不甘心啊啊啊啊啊啊。求人相告啊。 Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator