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:这道题目是什么意思。。。。谁能帮忙解释一下题意In Reply To:这道题目是什么意思。。。。谁能帮忙解释一下题意 Posted by:yf at 2006-07-11 19:01:51 > 真是郁闷,题意都没读懂! 给你代码你一看就懂什么意思了 //Ambiguous permutations #include <stdio.h> int p[100002]; int inverse[100001]; int init_pos[100001]; int n; void deal() { int i; for (i = 0; i < n; i++) { inverse[i] = init_pos[i + 1]; if (inverse[i] != p[i]) { printf("not ambiguous\n"); return; } } printf("ambiguous\n"); } void input() { scanf("%d", &n); while (n) { int i; for (i = 0; i < n; i++) { scanf("%d", &p[i]); init_pos[p[i]] = i + 1; } deal(); scanf("%d", &n); } } int main() { input(); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator