0
点赞
收藏
分享

微信扫一扫

Codeforces Round #767 (Div. 2) B. GCD Arrays(水题)

天天天蓝loveyou 2022-01-23 阅读 71
c++

题目大致意思,给你一个由[L,R]内的所有整数组成的一个数组,给你最多K次操作有没有办法让gcd最后结果为1

#include "bits/stdc++.h"
using namespace std;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    long long t,n,m,d,f=0;
    cin>>t;
    while (t--){
        cin>>n>>m>>d;
        f=0;
        if(n==1&&m==1)cout<<"NO"<<endl;
        else if(n==m)cout<<"YES"<<endl;
        else{
            if(n%2==1&&m%2==1){
                if(d>=(m-n+1)/2+1)f=1;
            }else if(d>=(m-n+1)/2)f=1;
            if(f)cout<<"YES"<<endl;
            else cout<<"NO"<<endl;
        }

    }
    return 0;
}
举报

相关推荐

0 条评论