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 |
怎么会是RE错误呢?#include<iostream> using namespace std; int c[10001]; int main() { int n,i,j; cin>>n; while(n--) { for(i=1;i<=10001;i++) { c[i]=i; } int N; int a,b,d,e; cin>>N; N--; while(N--) { cin>>a>>b; c[b]=a; } cin>>d>>e; for(i=d;c[i]!=i;i=c[i]) { int flag=0; for(j=e;c[j]!=j;j=c[j]) { if(i==j) { flag=1; break; } } if(flag)break; } cout<<i<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator