QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#511689#9167. Coprime Arrayucup-team3699#WA 0ms3544kbC++20509b2024-08-10 10:07:192024-08-10 10:07:20

Judging History

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

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

answer

#include<bits/stdc++.h>

using namespace std;

#define int long long 
#define pb push_back
#define F first 
#define S second

const int mol=1e9+7;


void solve(){
    int s, x;
    cin>>s>>x;
    vector<int>ans;
    int now=0;
    while(__gcd((s-now), x)!=1){
        now-=x-1;
        ans.pb(-x+1);
    }
    ans.pb(s-now);
    cout<<ans.size()<<"\n";
    for(int i: ans) cout<<i<<" ";
}


signed main(){
    ios::sync_with_stdio(0);cin.tie(0);
    solve();    
    return 0;
}

详细

Test #1:

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

input:

9 6

output:

3
-5 -5 19 

result:

ok Correct

Test #2:

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

input:

14 34

output:

2
-33 47 

result:

ok Correct

Test #3:

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

input:

1000000000 223092870

output:

4
-223092869 -223092869 -223092869 1669278607 

result:

wrong answer Integer element a[4] equals to 1669278607, violates the range [-10^9, 10^9]