Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 287 Accepted Submission(s): 184
Special Judge
1 //2016.10.08 2 #include <iostream> 3 #include <cstdio> 4 #include <cstring> 5 6 using namespace std; 7 8 int main() 9 { 10 int T, n, k, kase = 0; 11 scanf("%d", &T); 12 while(T--) 13 { 14 int tmp = -1; 15 scanf("%d%d", &n, &k); 16 printf("Case #%d:", ++kase); 17 if(k == 1){ 18 for(int i = 1; i <= n; i++) 19 printf(" %d", i); 20 }else{ 21 if(k&1){ 22 printf(" %d %d", 2*k, k); 23 for(int i = 2; i <= n; i++) 24 { 25 if(i == 2*k)continue; 26 if(i == k)printf(" 1"); 27 else printf(" %d", i); 28 } 29 }else{ 30 printf(" %d %d", 2*k, k); 31 for(int i = 1; i <= n; i++) 32 { 33 if(i == k || i == 2*k)continue; 34 else printf(" %d", i); 35 } 36 } 37 } 38 printf("\n"); 39 } 40 41 return 0; 42 }
原文:http://www.cnblogs.com/Penn000/p/5940219.html