QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#512023 | #9167. Coprime Array | ucup-team956# | WA | 0ms | 3636kb | C++20 | 881b | 2024-08-10 13:18:15 | 2024-08-10 13:18:16 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define time chrono::system_clock::now().time_since_epoch().count()
mt19937_64 rnd(time);
#define maxn 1000005
#define int long long
int read() {int x;cin>>x;return x;}
void solve() {
int n = read(), s = read();
if(__gcd(n, s) == 1) {
cout << 1 << "\n" << n << "\n";
}
else if(__gcd(n + 1, s) == 1 || __gcd(n - 1, s) == 1) {
cout << 2 << "\n";
if(__gcd(n + 1, s) == 1) cout << n + 1 << " " << 1 << "\n";
else cout << n - 1 << " " << 1 << "\n";
}
else {
cout << 3 << "\n";
cout << n - 2 << " " << 1 << " " << 1 << "\n";
}
}
signed main() {
#ifdef ONLINE_JUDGE
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
#else
//freopen("a.in", "r", stdin);
#endif
solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3612kb
input:
9 6
output:
3 7 1 1
result:
ok Correct
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3636kb
input:
14 34
output:
2 15 1
result:
wrong answer Sum of the elements is not equal to s