0
点赞
收藏
分享

微信扫一扫

Codeforces Round #808 (Div. 2)

心如止水_c736 2022-07-27 阅读 173

A

 Codeforces Round #808 (Div. 2)_ios


思路:a【1】是其他元素的因子,不易证


/**/
#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;
}






B



 Codeforces Round #808 (Div. 2)_#include_02



思路:检查l--r之间是否有i的倍数


#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';
}

}


C

 Codeforces Round #808 (Div. 2)_ios_03








举报

相关推荐

0 条评论