QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#548089#9167. Coprime Arrayparamec1um#WA 0ms3736kbC++20524b2024-09-05 15:23:462024-09-05 15:23:47

Judging History

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

  • [2024-09-05 15:23:47]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3736kb
  • [2024-09-05 15:23:46]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define IN inline
typedef long long ll;
const int maxn=2e5+10;
ll gcd(ll a,ll b){
	if(!b)return a;
	return gcd(b,a%b);
}
void solve(){
	int s,k;cin>>s>>k;
	if(gcd(s,k)==1)cout<<"1\n"<<s<<'\n';
	else{
		if(gcd(s-1,k)==1)cout<<"2\n"<<"1 "<<s-1<<'\n';
		else cout<<"3\n1 1 "<<s-2<<'\n';
	}
}
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	//fstream in("in.txt",ios::in);cin.rdbuf(in.rdbuf());
	int T=1;//cin>>T;
	while(T--)solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

9 6

output:

3
1 1 7

result:

ok Correct

Test #2:

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

input:

14 34

output:

2
1 13

result:

ok Correct

Test #3:

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

input:

1000000000 223092870

output:

3
1 1 999999998

result:

wrong answer Element at position 3 is not coprime to x