| ||||||||||
| 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 | |||||||||
Re:next_permutation() 好使。。。水过In Reply To:next_permutation() 好使。。。水过 Posted by:zihuacs at 2010-08-18 22:52:22 我也用了,但是超时啊!!
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int n1,n,k,i,j,a[1024];
cin>>n1;
while(n1--)
{
cin>>n>>k;
for(i=0;i<n;i++,j++)
{
cin>>j;
a[i]=j;
}
for(i=0;i<k;i++)
next_permutation(a,a+n);
for(i=0;i<n;i++)
cout<<a[i]<<' ';
cout<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator