【acm】2020icpc南京补题

K.K Co-prime Permutation

一个重要的知识点

gcd(1,x) = 1;
gcd(x,x-1) = 1;

#include <bits/stdc++.h>
using namespace std;

int a[1000005];

void sovle()
{
    int n,k;
    cin >> n >> k;
    
    if(k == 0){
        cout << -1 << endl;
        return ;
    }
    
    for(int i =  2 ; i <= k; i++){
        cout << i <<" ";
    }
    cout << 1 << " ";
    for(int i = k + 1; i <= n ;i++){
        cout << i << " ";
    }
    cout << endl;
    
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    sovle();
    return 0;
}

后记:

对于这次比赛,我觉得有一个很重要的能力就是~ 题意转换 ~

posted @ 2020-12-21 00:53  Hoppz  阅读(112)  评论(0编辑  收藏  举报