QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#511689 | #9167. Coprime Array | ucup-team3699# | WA | 0ms | 3544kb | C++20 | 509b | 2024-08-10 10:07:19 | 2024-08-10 10:07:20 |
Judging History
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]