QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#722866#9167. Coprime ArrayguanzyWA 0ms3816kbC++14451b2024-11-07 20:27:102024-11-07 20:27:10

Judging History

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

  • [2024-11-07 20:27:10]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3816kb
  • [2024-11-07 20:27:10]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int s,x;
int gcd(int a,int b){
	return !b?a:gcd(b,a%b);
}
int main(){
	cin>>s>>x;
	if(gcd(s,x)==1){
		printf("1\n%d",s);
	}else if(x%2==0&&s%2==1){
		printf("3\n");
		int k=s+2;
		while(gcd(k,x)>1||gcd((k-s)/2,x)>1) k+=2;
		printf("%d %d %d",-k,(k-s)/2,(k-s)/2);
	}else{
		printf("2\n");
		int k=s+1;
		while(gcd(k,x)>1||gcd(k-s,x)>1) k++;
		printf("%d %d",-k,k-s);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3816kb

input:

9 6

output:

3
-11 1 1

result:

wrong answer Sum of the elements is not equal to s