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 |
不知道怎么一次就ac了。附上代码#include<iostream> using namespace std; int a[100005]; int main() { int i,j,n; while(scanf("%d",&n)&&n!=0) { int tmp=1; for(i=1;i<=n;i++) scanf("%d",&a[i]); for(i=1;i<=n;i++) { if(a[a[i]]!=i) { tmp=0; break; } } if(tmp==0) printf("not ambiguous\n"); else printf("ambiguous\n"); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator