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 |
表示这东西是个环。。。#include <cstdio> #include <cstring> #include <cstdlib> #include <iostream> #include <algorithm> using namespace std; int T; int a[1025]; int main(){ scanf("%d",&T); while(T --){ int N,K; scanf("%d%d",&N,&K); for(int i = 1;i <= N;++ i) scanf("%d",&a[i]); for(int i = 1;i <= K;++ i){ if(next_permutation(a+1,a+N+1)){ continue; } else{ for(int i = 1;i <= N;++ i) a[i] = i; } } for(int i = 1;i <= N;++ i) printf("%d ",a[i]); printf("\n"); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator