QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#548089 | #9167. Coprime Array | paramec1um# | WA | 0ms | 3736kb | C++20 | 524b | 2024-09-05 15:23:46 | 2024-09-05 15:23:47 |
Judging History
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