其他分享
首页 > 其他分享> > Codeforces Round #764 (Div. 3) 复盘B

Codeforces Round #764 (Div. 3) 复盘B

作者:互联网

Codeforces Round #764 (Div. 3) 复盘B

#include <bits/stdc++.h>
using namespace std;
int t, a, b, c, na, nb, nc;

int main() {
    scanf("%d", &t);
    for (int i = 1; i <= t; i++) {
        scanf("%d%d%d", &a, &b, &c);
        na = 2 * b - c;
        if (na >= a && na != 0 && na % a == 0) {
            printf("YES\n");
            continue;
        }
        nb = (a + c) / 2; //a+(a-c)/2
        if (nb >= b && (a - c) % 2 == 0 && nb % b == 0 && nb != 0) {//(a-c)/2为公差 公差不能为奇数
            printf("YES\n");
            continue;
        }
        nc = 2 * b - a;
        if (nc >= c && nc != 0 && nc % c == 0) {
            printf("YES\n");
            continue;
        }
        printf("NO\n");
    }
    return 0;
}

 

标签:int,na,nb,nc,Codeforces,764,&&,printf,Div
来源: https://www.cnblogs.com/Qhnanana/p/15791605.html