QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#724997 | #9167. Coprime Array | gzy | WA | 0ms | 3820kb | C++14 | 633b | 2024-11-08 15:50:44 | 2024-11-08 15:50:45 |
Judging History
answer
#include<bits/stdc++.h>
#define pb push_back
#define pi pair<int,int>
#define F first
#define S second
#define mp make_pair
#define vector basic_string
using namespace std;
using ll = long long;
using db = double;
const int N = 2e5 + 7;
int i, j, k, n, m;
ll s;
vector<int> d;
int main() {
// freopen(".in", "r", stdin);
// freopen(".out", "w", stdout);
// ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
scanf("%d%d", &n, &m);
while(1) {
if(__gcd(m, n + k) == 1) break;
++k;
}
cout << k + 1 << "\n";
for(i = 1; i <= k; i++) cout << -m-1 << " ", s += -m-1;
cout << n - s;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3768kb
input:
9 6
output:
3 -7 -7 23
result:
ok Correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
14 34
output:
2 -35 49
result:
ok Correct
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3760kb
input:
1000000000 223092870
output:
8 -223092871 -223092871 -223092871 -223092871 -223092871 -223092871 -223092871 2561650097
result:
wrong answer Integer element a[8] equals to 2561650097, violates the range [-10^9, 10^9]