QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#725118 | #9167. Coprime Array | gzy | WA | 0ms | 3632kb | C++14 | 787b | 2024-11-08 16:20:52 | 2024-11-08 16:20:52 |
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
#define gcd __gcd
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;
}
if(__gcd(k, m) == 1) {
cout << "2\n" << -k << " " << n + k << "\n";
} else {
cout << "3\n";
for(i = 1; i <= k; i++) {
if(gcd(i, m) == 1 && gcd(k - i, m)) break;
}
cout << n+k-m << " " << m+i << " " << -k-i;
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3632kb
input:
9 6
output:
3 5 7 -3
result:
wrong answer Element at position 3 is not coprime to x