QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#516559#9167. Coprime ArrayKavenSkyWA 7ms3648kbC++23844b2024-08-12 18:42:002024-08-12 18:42:01

Judging History

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

  • [2024-08-12 18:42:01]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:3648kb
  • [2024-08-12 18:42:00]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int>P;
using ll = long long;
const ll N = 2e5 + 5;
void solve(){
    ll s,x;
    cin >> s >> x;
    if(__gcd(s,x)==1){
        cout << 1 << "\n";
        cout << s << "\n";
        return;
    }
    for(ll i=x;i<=100000;i++){
        if(__gcd(x,i)==1&&__gcd(s-i,x)==1){
            cout << 2 << "\n";
            cout << i << " " << s-i << "\n";
            return;
        }
    }
    for(ll i=1;i<=100000;i++){
        if(__gcd(x,i)==1&&__gcd(s-1-i,x)==1){
            cout << 3 << "\n";
            cout << i << " " << s-i-1 << " " << 1 << "\n";
            return;
        }
    }
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    ll 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: 2ms
memory: 3616kb

input:

9 6

output:

3
1 7 1

result:

ok Correct

Test #2:

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

input:

14 34

output:

2
41 -27

result:

ok Correct

Test #3:

score: -100
Wrong Answer
time: 7ms
memory: 3556kb

input:

1000000000 223092870

output:


result:

wrong output format Unexpected end of file - int32 expected