【HDOJ】4985 Little Pony and Permutation
2014-08-31 21:35
344 查看
水题。
#include <cstdio> #define MAXN 100005 int buf[MAXN], n; int main() { int i, j, k; while (scanf("%d", &n) != EOF) { for (i=1; i<=n; ++i) scanf("%d", &buf[i]); for (i=1; i<=n; ++i) { if (buf[i]) { printf("(%d", i); j = buf[i]; buf[i] = 0; while (buf[j]) { printf(" %d", j); k = buf[j]; buf[j] = 0; j = k; } printf(")"); } } printf("\n"); } return 0; }
相关文章推荐
- 【强连通分量】 HDOJ 4985 Little Pony and Permutation
- hdu 4985 Little Pony and Permutation(置换)
- hdu 4985 Little Pony and Permutation
- HDU 4985 Little Pony and Permutation(置换)
- HDU 4985 Little Pony and Permutation(简单模拟)
- 杭电4985 Little Pony and Permutation(水置换)
- 【HDU】4985 Little Pony and Permutation 置换群
- 【CUGBACM15级BC第7场 A】hdu 4985 Little Pony and Permutation
- HDU 4985 Little Pony and Permutation(数学 置换群)
- HDU 4985-Little Pony and Permutation(模拟置换)
- BestCoder7 1001 Little Pony and Permutation(hdu 4985) 解题报告
- hdu 4985 Little Pony and Permutation(水题)
- [BestCoder Round #7] hdu 4985 Little Pony and Permutation (找循环节)
- HDU4985&&bestcoder #7 1001 Little Pony and Permutation(水题)
- bestcoder Round-#7 1001 Little Pony and Permutation
- 【数论】 HDOJ 4986 Little Pony and Alohomora Part I
- 【HDOJ】4986 Little Pony and Alohomora Part I
- Codeforces Round #259 (Div. 2) C Little Pony and Expected Maximum
- Codeforces Round #259 (Div. 2) B. Little Pony and Sort by Shift
- Codeforces Round #259 (Div. 2) E. Little Pony and Summer Sun Celebration