QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#695635 | #9167. Coprime Array | 11d10xy | AC ✓ | 0ms | 3956kb | C++14 | 393b | 2024-10-31 20:29:29 | 2024-10-31 20:29:31 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
mt19937 g(114514);
int main(){
int s,x;scanf("%d%d",&s,&x);
if(__gcd(x,s)==1)return printf("1\n%d",s),0;
bool flag=false;
if(s&1&&~x&1)flag=true,s--;
int y,z;
do y=g()%1000000000+1,z=s-y;
while(__gcd(x,y)!=1||__gcd(x,abs(z))!=1);
if(flag)printf("3\n1 %d %d",y,z);
else printf("2\n%d %d",y,z);
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3888kb
input:
9 6
output:
3 1 102478207 -102478199
result:
ok Correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3772kb
input:
14 34
output:
2 832282235 -832282221
result:
ok Correct
Test #3:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
1000000000 223092870
output:
2 710267573 289732427
result:
ok Correct
Test #4:
score: 0
Accepted
time: 0ms
memory: 3952kb
input:
2 1000000000
output:
2 363098391 -363098389
result:
ok Correct
Test #5:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
649557664 933437700
output:
2 9400091 640157573
result:
ok Correct
Test #6:
score: 0
Accepted
time: 0ms
memory: 3956kb
input:
33396678 777360870
output:
2 44203921 -10807243
result:
ok Correct
Test #7:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
48205845 903124530
output:
3 1 102478207 -54272363
result:
ok Correct
Test #8:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
251037078 505905400
output:
2 664774287 -413737209
result:
ok Correct
Test #9:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
30022920 172746860
output:
2 363098391 -333075471
result:
ok Correct
Test #10:
score: 0
Accepted
time: 0ms
memory: 3952kb
input:
63639298 808058790
output:
2 160853717 -97214419
result:
ok Correct
Test #11:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
76579017 362768406
output:
3 1 44203921 32375095
result:
ok Correct
Test #12:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
40423669 121437778
output:
3 1 832282235 -791858567
result:
ok Correct
Test #13:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
449277309 720915195
output:
2 549084028 -99806719
result:
ok Correct
Test #14:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
81665969 919836918
output:
3 1 832282235 -750616267
result:
ok Correct
Test #15:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
470578680 280387800
output:
2 155330269 315248411
result:
ok Correct
Test #16:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
58450340 803305503
output:
2 549084028 -490633688
result:
ok Correct
Test #17:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
125896113 323676210
output:
3 1 155330269 -29434157
result:
ok Correct
Test #18:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
381905348 434752500
output:
2 155330269 226575079
result:
ok Correct
Test #19:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
78916498 653897673
output:
1 78916498
result:
ok Correct
Test #20:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
35787885 270845190
output:
3 1 384816001 -349028117
result:
ok Correct
Extra Test:
score: 0
Extra Test Passed