QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#14775 | #681. Division expression | JohnAlfnov | 100 ✓ | 25ms | 3880kb | C++98 | 681b | 2021-10-15 10:34:28 | 2022-05-17 01:01:55 |
Judging History
answer
#include<iostream>
#include<cstdlib>
#include<cstdio>
using namespace std;
int gcd(int a,int b)
{
if(b==0)return a;
return gcd(b,a%b);
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n;
int a[10005]={0};
scanf("%d",&n);
for(int i=1;i<=n;i++)
scanf("%d",a+i);
if(n==1)
{
printf("YES\n");
continue;
}
if(n==2)
{
if(a[1]%a[2]==0)printf("YES\n");
else printf("NO\n");
continue;
}
bool flag=true;
for(int i=1;i<=n;i++)
{
if(i==2)continue;
a[2]=a[2]/gcd(a[2],a[i]);
if(a[2]==1&&flag)
{
printf("YES\n");
flag=false;
}
}
if(flag)printf("NO\n");
}
return 0;
}
詳細信息
Test #1:
score: 9.09091
Accepted
time: 3ms
memory: 3876kb
input:
5 100 121 120 203 161 931 203 203 377 884 437 323 589 299 527 589 713 133 203 221 391 529 253 667 323 203 551 161 209 551 187 899 133 589 217 361 91 637 713 319 289 77 323 667 341 143 391 493 323 187 551 161 899 713 377 399 931 493 209 299 377 299 310 713 391 589 899 77 899 403 253 221 527 437 169 2...
output:
YES YES NO NO NO
result:
ok 5 lines
Test #2:
score: 9.09091
Accepted
time: 3ms
memory: 3612kb
input:
5 100 121 120 203 161 931 203 203 377 884 437 323 589 299 527 589 713 133 203 221 391 529 253 667 323 203 551 161 209 551 187 899 133 589 217 361 91 637 713 319 289 77 323 667 341 143 391 493 323 187 551 161 899 713 377 399 931 493 209 299 377 299 310 713 391 589 899 77 899 403 253 221 527 437 169 2...
output:
YES YES NO NO NO
result:
ok 5 lines
Test #3:
score: 9.09091
Accepted
time: 3ms
memory: 3608kb
input:
5 500 988 315 38 899 299 551 319 598 299 646 209 874 638 187 242 437 253 143 187 319 899 437 527 437 578 493 874 221 638 899 136 247 52 494 713 494 116 418 506 527 442 299 338 874 841 638 323 646 374 598 713 646 754 754 289 319 442 46 221 715 899 961 323 713 299 323 529 493 323 209 319 646 62 169 71...
output:
NO YES YES NO YES
result:
ok 5 lines
Test #4:
score: 9.09091
Accepted
time: 4ms
memory: 3792kb
input:
5 2000 551 135 391 238 551 221 77 46 58 713 899 161 203 124 437 377 266 442 77 403 899 986 986 319 217 418 247 221 638 782 217 221 713 638 646 217 899 551 527 377 551 341 748 406 217 341 713 377 343 319 391 247 319 203 62 644 289 221 266 187 77 221 247 374 551 217 437 203 377 319 286 667 299 841 506...
output:
NO NO YES YES YES
result:
ok 5 lines
Test #5:
score: 9.09091
Accepted
time: 10ms
memory: 3824kb
input:
5 10000 323 240 713 323 203 253 667 91 391 253 143 169 319 527 403 319 833 551 529 391 49 713 319 341 551 319 319 133 209 833 493 961 899 437 209 253 341 713 323 133 169 169 133 133 299 403 221 437 403 133 119 899 493 121 667 319 77 527 299 169 221 527 133 361 377 169 841 289 589 493 529 299 341 119...
output:
YES NO YES YES NO
result:
ok 5 lines
Test #6:
score: 9.09091
Accepted
time: 10ms
memory: 3796kb
input:
5 10000 152137 244608 337123 176563 444931 286213 383359 438019 44117 826919 451483 306881 246023 273991 95593 250639 351677 132467 307883 586343 177557 64117 412673 204709 292937 64313 296029 720701 247417 332977 55753 420943 16271 375793 84611 76639 136831 140513 19711 439013 161113 176963 16609 3...
output:
NO YES NO YES YES
result:
ok 5 lines
Test #7:
score: 9.09091
Accepted
time: 2ms
memory: 3792kb
input:
5 10000 27354979 143570775 417616369 144122281 13741703 660857861 89932477 736017047 191826937 13189669 382619009 517975357 360390829 143499641 81848861 186147979 58684933 97265281 27783953 40453739 241016851 271109941 670798757 295248647 9030799 414663023 40454891 198420037 42178883 47886899 290864...
output:
NO NO YES YES YES
result:
ok 5 lines
Test #8:
score: 9.09091
Accepted
time: 18ms
memory: 3880kb
input:
5 10000 96413621 240567030 402889343 99982411 516232039 329409029 580706827 50489287 14248789 50503967 200983309 583549453 200302183 298589659 563597623 184860283 588750737 547490059 416791259 310248277 587941 281387567 333144787 105375793 657787349 122728951 525967363 65838809 11482561 17018879 242...
output:
NO YES NO NO YES
result:
ok 5 lines
Test #9:
score: 9.09091
Accepted
time: 12ms
memory: 3808kb
input:
5 10000 156441437 283932675 128118241 64406357 96305753 278345033 35896793 63216481 464805521 281508719 792973471 33995729 574984609 613173959 319785887 72597853 29040257 113192257 315117001 268745629 285183091 388238611 59680783 211502407 142735933 38818861 47027237 39599801 306289609 52103017 2139...
output:
NO NO YES YES YES
result:
ok 5 lines
Test #10:
score: 9.09091
Accepted
time: 15ms
memory: 3808kb
input:
5 10000 121757327 136625330 55986727 46763099 119385043 178984717 381522941 357202819 189240529 10967153 54487109 19077529 340595309 448888373 129570689 144087271 749307367 87959777 169989107 510590237 282331747 504191 47687603 245041201 207236903 181790573 317473729 282594119 63724831 44576999 1694...
output:
NO YES NO YES NO
result:
ok 5 lines
Test #11:
score: 9.09091
Accepted
time: 25ms
memory: 3812kb
input:
5 10000 267914296 433494437 267914296 267914296 267914296 701408733 267914296 701408733 701408733 267914296 267914296 701408733 701408733 701408733 701408733 701408733 267914296 267914296 267914296 267914296 267914296 701408733 701408733 267914296 267914296 267914296 701408733 701408733 701408733 26...
output:
YES NO YES NO YES
result:
ok 5 lines