QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#512023#9167. Coprime Arrayucup-team956#WA 0ms3636kbC++20881b2024-08-10 13:18:152024-08-10 13:18:16

Judging History

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

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

answer

#include<bits/stdc++.h>
using namespace std;
#define time chrono::system_clock::now().time_since_epoch().count()
mt19937_64 rnd(time);
#define maxn 1000005
#define int long long

int read() {int x;cin>>x;return x;}

void solve() {
    int n = read(), s = read();
    if(__gcd(n, s) == 1) {
        cout << 1 << "\n" << n << "\n";
    }
    else if(__gcd(n + 1, s) == 1 || __gcd(n - 1, s) == 1) {
        cout << 2 << "\n";
        if(__gcd(n + 1, s) == 1) cout << n + 1 << " " << 1 << "\n";
        else cout << n - 1 << " " << 1 << "\n";
    }
    else {
        cout << 3 << "\n";
        cout << n - 2 << " " << 1 << " " << 1 << "\n"; 
    }
}

signed main() {
    #ifdef ONLINE_JUDGE
        ios::sync_with_stdio(false);
        cin.tie(0);cout.tie(0);
    #else
        //freopen("a.in", "r", stdin);
    #endif

    solve();
    return 0;
}

詳細信息

Test #1:

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

input:

9 6

output:

3
7 1 1

result:

ok Correct

Test #2:

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

input:

14 34

output:

2
15 1

result:

wrong answer Sum of the elements is not equal to s