标签:
http://www.spoj.com/problems/PERMUT2/
如题。。
#include<cstdio> #include<cstring> int n,i,j; int a[100005]; int main(){ while(scanf("%d",&n)&&n){ for (i=1;i<=n;i++){ scanf("%d",&a[i]); } for (i=1;i<=n;i++){ if (a[a[i]]!=i){printf("not ");break;} } printf("ambiguous\n"); } }
SPOJ Problem 379:Ambiguous Permutations
标签:
原文地址:http://www.cnblogs.com/moris/p/4319043.html