QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#725071#9167. Coprime ArraygzyWA 0ms3820kbC++14750b2024-11-08 16:08:192024-11-08 16:08:19

Judging History

你现在查看的是最新测评结果

  • [2024-11-08 16:08:19]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3820kb
  • [2024-11-08 16:08:19]
  • 提交

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;
	}
	if(__gcd(k, m) == 1) {
		cout << "2\n" << k << " " << n - k << "\n";
	} else {
		cout << "3\n";
		for(i = 1; i <= k; i++) {
			if(__gcd(m, i) == 1) break;
		}
		cout << n+k << " " << -i << " " << -(k-i);
	}
	return 0;
}



详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3720kb

input:

9 6

output:

3
11 -1 -1

result:

ok Correct

Test #2:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

14 34

output:

2
1 13

result:

ok Correct

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3820kb

input:

1000000000 223092870

output:

3
1000000007 -1 -6

result:

wrong answer Integer element a[1] equals to 1000000007, violates the range [-10^9, 10^9]