标签:表示 str limit 顺序 output 就是 efi href amp
| Time Limit: 1000MS | Memory Limit: 30000K | |
| Total Submissions: 21268 | Accepted: 8049 | 
Description
Input
Output
Sample Input
3 3 1 2 3 1 3 1 3 2 1 10 2 1 2 3 4 5 6 7 8 9 10
Sample Output
3 1 2 1 2 3 1 2 3 4 5 6 7 9 8 10
Source
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <queue>
#include <cstdio>
#include <vector>
#include <string>
#include <cstring>
#include <iterator>
#include <iostream>
#include <algorithm>
#define debug(a) cout << #a << " " << a << endl
using namespace std;
const int maxn = 2*1e4 + 10;
const int mod = 10000;
typedef long long ll;
ll num[maxn];
int main() {
    std::ios::sync_with_stdio(false);
    ll t;
    scanf("%lld",&t);
    while( t -- ) {
        ll n, m;
        scanf("%lld %lld", &n, &m);
        for( ll i = 0; i < n; i ++ ) {
            scanf("%lld",&num[i]);
        }
        for( ll i = 0; i < m; i ++ ) {
            next_permutation( num, num + n );
        }
        copy( num, num+n-1, ostream_iterator<ll>(cout, " "));
        cout << num[n-1] << endl;
    }
    return 0;
}
POJ1833 排列 调用全排列函数 用copy函数节省时间 即使用了ios同步代码scanf还是比较快
标签:表示 str limit 顺序 output 就是 efi href amp
原文地址:https://www.cnblogs.com/l609929321/p/9320635.html