Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

不知道怎么一次就ac了。附上代码

Posted by zhangkeabcd at 2010-08-08 23:06:56 on Problem 2470
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator