QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#612297 | #6428. K Co-prime Permutation | zyq_313# | WA | 0ms | 3604kb | C++14 | 677b | 2024-10-05 10:20:01 | 2024-10-05 10:20:05 |
Judging History
answer
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n, k;
int main(){
cin >> n >> k;
if (k & 1){
cout << 1;
int b = 1;
for (int i = 1; i <= k / 2; i ++){
cout << ' ' << b + 2 << ' ' << b + 1;
b += 2;
}
for (int i = b + 1; i <= n; i ++){
cout << ' ' << i;
}
}else{
int b = 1;
for (int i = 1; i <= k / 2; i ++){
cout << ' ' << b + 1 << ' ' << b;
b += 2;
}
for (int i = b; i <= n; i ++){
cout << ' ' << i;
}
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3604kb
input:
5 3
output:
1 3 2 4 5
result:
ok ac
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3604kb
input:
1 0
output:
1
result:
wrong answer wa