QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#543466 | #9167. Coprime Array | FavorGew# | WA | 1ms | 3708kb | C++20 | 689b | 2024-09-01 16:55:16 | 2024-09-01 16:55:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int s, x;
cin >> s >> x;
if(__gcd(s, x) == 1) {
cout << 1 << "\n" << s << "\n";
return 0;
}
if(s % 2 == 1) {
for(int i = 1; ; ++ i) {
if(__gcd(i, x) == 1 && __gcd(s - 2 * i, x) == 1) {
cout << 3 << "\n" << i << " " << i << " " << s - 2 * i << "\n";
return 0;
}
}
}
for(int i = 1; ; ++ i) {
if(__gcd(i, x) == 1 && __gcd(s - i, x) == 1) {
cout << 2 << "\n" << i << " " << s - i << "\n";
return 0;
}
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3704kb
input:
9 6
output:
3 1 1 7
result:
ok Correct
Test #2:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
14 34
output:
2 1 13
result:
ok Correct
Test #3:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
1000000000 223092870
output:
2 29 999999971
result:
ok Correct
Test #4:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
2 1000000000
output:
2 1 1
result:
ok Correct
Test #5:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
649557664 933437700
output:
2 11 649557653
result:
ok Correct
Test #6:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
33396678 777360870
output:
2 1 33396677
result:
ok Correct
Test #7:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
48205845 903124530
output:
3 13 13 48205819
result:
ok Correct
Test #8:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
251037078 505905400
output:
2 1 251037077
result:
ok Correct
Test #9:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
30022920 172746860
output:
2 1 30022919
result:
ok Correct
Test #10:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
63639298 808058790
output:
2 29 63639269
result:
ok Correct
Test #11:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
76579017 362768406
output:
3 1 1 76579015
result:
ok Correct
Test #12:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
40423669 121437778
output:
3 1 1 40423667
result:
ok Correct
Test #13:
score: -100
Wrong Answer
time: 0ms
memory: 3616kb
input:
449277309 720915195
output:
3 1 1 449277307
result:
wrong answer Jury's answer is better than participant's