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 |
您给讲下题目意思吧,没看懂In Reply To:帮忙看看我的构造哪里不对 Posted by:daringQQ at 2006-07-06 21:24:38 > while (scanf("%d", &n), n) > { > memset(flag, 0, sizeof(flag)); > for (i = 1; i <= n; i++) > { > scanf("%d", &a[i]); > flag[a[i]] = 1; > } > for (i = 1; i <= n; i++) > if (!flag[i]) > { > printf("No solution\n"); > break; > } > if (i <= n) continue; > top = 0; > for (i = 1; i <= n; i++) > for (j = i; j <= n; j++) > if (a[j] == i) > { > for (k = j; k > i; k--) > { > s[top++] = k-1; > a[k] = a[k-1]; > } > a[i] = i; > break; > } > printf("%d", top); > while (top) > { > printf(" %d", s[--top]); > } > printf("\n"); > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator