A

Ideas :a【1】 Is the factor of other elements , Not easy to prove
/**/
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i <= b; i ++)
#define endl '\n'
using
namespace
std;
const
int
N
=
100
+
5,
INF
=
1e9
+
5;
int
a[
N];
void
s(){
int
n ;
cin
>>
n;
for(
int
i
=
1;
i
<=
n;
i
++)
cin
>>
a[
i];
for(
int
i
=
2;
i
<=
n ;
i
++){
if(
a[
i]
%
a[
1]
!=
0) {
cout
<<
"NO\n";
return ;
}
}
cout
<<
"YES\n";
}
int
main(){
cin.
tie(
0);
cout.
tie(
0);
ios::sync_with_stdio(
0);
int
t;
cin
>>
t;
while(
t
--)
s();
return
0;
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
B

Ideas : Check l--r Whether there is i Multiple
#include<iostream>
#include<cstring>
using
namespace
std;
typedef
long
long
LL;
const
int
maxn
=
1e5
+
5,
INF
=
0x3f3f3f3f;
int
ans[
maxn];
int
main(){
cin.
tie(
0);
cout.
tie(
0);
ios::sync_with_stdio(
0);
int
T;
cin
>>
T;
while(
T
--){
int
n,
l,
r;
cin
>>
n
>>
l
>>
r;
bool
success
=
1;
for(
int
i
=
1;
i
<=
n;
i
++){
int
t
= (
l
+
i
-
1)
/
i
*
i;
if (
t
>
r){
success
=
0;
break;
}
ans[
i]
=
t;
}
if (
success){
cout
<<
"YES"
<<
'\n';
for(
int
i
=
1;
i
<=
n;
i
++)
cout
<<
ans[
i]
<<
" \n"[
i
==
n];
}
else
cout
<<
"NO"
<<
'\n';
}
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
C

原网站版权声明
本文为[51CTO]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/202/202207202218539192.html