QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#511962#9167. Coprime Arrayucup-team052#WA 0ms3680kbC++23594b2024-08-10 13:06:122024-08-10 13:06:12

Judging History

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

  • [2024-08-11 17:38:28]
  • hack成功,自动添加数据
  • (/hack/775)
  • [2024-08-10 13:06:12]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3680kb
  • [2024-08-10 13:06:12]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int s, x;

int main() {
	cin >> s >> x;
	if (__gcd(s, x) == 1) {
		cout << 1 << '\n';
		cout << s << '\n';
		return 0;
	}
	if (x % 2 == 0 && s % 2 == 1) {
		for (int i = 1; ; i += 2) {
			if (__gcd(i, x) == 1 && __gcd(i * 2 + s, x) == 1) {
				cout << 3 << '\n';
				cout << -i << ' ' << -i << ' ' << i * 2 + s << '\n';
				return 0;
			}
		}
	}
	for (int i = 1; ; i += 2) {
		if (__gcd(i, x) == 1 && __gcd(i + s, x) == 1) {
			cout << 2 << '\n';
			cout << -i << ' ' << i + s << '\n';
			return 0;
		}
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

9 6

output:

3
-1 -1 11

result:

ok Correct

Test #2:

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

input:

14 34

output:

2
-1 15

result:

ok Correct

Test #3:

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

input:

1000000000 223092870

output:

2
-31 1000000031

result:

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