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 |
cin 和 scanf 花费的时间区别很大#include <iostream> #include <cstdio> using namespace std; int solver(int num[],int n) { for(int i=1;i<=n;i++) if(num[num[i]]!=i) return 0; return 1; } void main() { int n; int num[100001]; cin>>n; while(n) { for(int i=1;i<=n;i++) scanf("%d",&num[i]);//过 //cin>>num[i];//不过 if(solver(num,n)) cout<<"ambiguous"<<endl; else cout<<"not ambiguous"<<endl; cin>>n; } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator