Skip to content

Commit fc8f863

Browse files
committed
Create 1716B-PermutationChain.cpp
1 parent b38a6e1 commit fc8f863

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

1716B-PermutationChain.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <cstdio>
2+
#include <vector>
3+
4+
int main(){
5+
6+
long t; scanf("%ld", &t);
7+
while(t--){
8+
long n; scanf("%ld", &n);
9+
std::vector<long> a(n); for(long p = 0; p < n; p++){a[p] = p + 1;}
10+
printf("%ld\n", n);
11+
for(long p = 0; p < n; p++){printf("%ld ", a[p]);}; puts("");
12+
for(long p = 1; p < n; p++){
13+
long tmp = a[p]; a[p] = a[p - 1]; a[p - 1] = tmp;
14+
for(long p = 0; p < n; p++){printf("%ld ", a[p]);}
15+
puts("");
16+
}
17+
18+
}
19+
20+
}

0 commit comments

Comments
 (0)