Educational Codeforces Round 77 (Rated for Div. 2) B. Obtain Two Zeroes

题目:https://codeforces.com/contest/1260/problem/B
思路:易得成立的条件为:\((a+b)\mod3==0\) && \(max(a,b)\le min(a,b)*2\)

#include<bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T;cin>>T;
    while(T--)
    {
        int a,b;
        cin>>a>>b;
        if((a+b)%3==0&&max(a,b)<=min(a,b)*2) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}

原文地址:https://www.cnblogs.com/c4Lnn/p/12104200.html

时间: 2024-11-10 05:38:34

Educational Codeforces Round 77 (Rated for Div. 2) B. Obtain Two Zeroes的相关文章

Educational Codeforces Round 77 (Rated for Div. 2) C. Infinite Fence

C. Infinite Fence 题目大意:给板子涂色,首先板子是顺序的,然后可以涂两种颜色,如果是r的倍数涂成红色,是b的倍数涂成蓝色, 连续的k个相同的颜色则不能完成任务,能完成任务则输出OBEY,否则输出REBEL 首先我们可以求b,r的gcd d=gcd(b,r) 然后b/=d,r/=d 然后让r<b  if(r>b) swap(b,r) 然后如果要连续k个板子颜色涂成r,则要占的长度是 len = r*(k-1)+1 如果这个长度len>b 则可以完成,否则不可以完成 这个原

Educational Codeforces Round 81 (Rated for Div. 2) C. Obtain The String

题目链接:http://codeforces.com/contest/1295/problem/C 题目:给定字符串s,t.  给定一个空串z,需要按照规则把z构造成 string z == string t 的字符串. 规则:有限次从s中任取子序列p,然后进行 string z += string p的操作, s不变. 问能不能构造出p,不能输出-1,可以得话最少几次可以构造出. 大致的想法就是n倍的s字符串串联,然后剔除不必要的字符,就可以得出z, 求最少的倍数n是多少. 主要思路就是用二分

Educational Codeforces Round 69 (Rated for Div. 2) B - Pillars

Educational Codeforces Round 69 (Rated for Div. 2) B - Pillars There are n pillars aligned in a row and numbered from 1 to n. Initially each pillar contains exactly one disk. The i-th pillar contains a disk having radius ai. You can move these disks

Educational Codeforces Round 71 (Rated for Div. 2) D - Number Of Permutations

原文链接:https://www.cnblogs.com/xwl3109377858/p/11405773.html Educational Codeforces Round 71 (Rated for Div. 2) D - Number Of Permutations You are given a sequence of n pairs of integers: (a1,b1),(a2,b2),…,(an,bn). This sequence is called bad if it is

Educational Codeforces Round 36 (Rated for Div. 2)

Educational Codeforces Round 36 (Rated for Div. 2) F. Imbalance Value of a Tree You are given a tree T consisting of n vertices. A number is written on each vertex; the number written on vertex i is ai. Let's denote the function I(x,?y) as the differ

Educational Codeforces Round 36 (Rated for Div. 2) 题解

Educational Codeforces Round 36 (Rated for Div. 2) 题目的质量很不错(不看题解做不出来,笑 Codeforces 920C 题意 给定一个\(1\)到\(n\)组成的数组,只可以交换某些相邻的位置,问是否可以将数组调整为升序的 解题思路 首先如果每个数都能通过交换到它应该到的位置,那么就可以调整为升序的. 但实际上交换是对称的,如果应该在的位置在当前位置前方的数都交换完成,那么整体就是排好序的,因为不可能所有不在相应位置的数都在相应位置的后方.

Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes

Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://codeforces.com/contest/985/problem/E Description Mishka received a gift of multicolored pencils for his birthday! Unfortunately he lives in a monochrome w

Educational Codeforces Round 55 (Rated for Div. 2)

Educational Codeforces Round 55 (Rated for Div. 2) 链接 A Vasya and Book 傻逼题..注意判边界. #include<cstdio> #include<cstring> #include<algorithm> #include<queue> #include<set> #include<map> #include<vector> #include<cm

Educational Codeforces Round 57 (Rated for Div. 2)

get人生第二场CF! 成绩:(exACM) rank858 AC3/7 Penalty57 rating1648(+52) 题目:Educational Codeforces Round 57 (Rated for Div. 2) 错题题解: D. Easy Problem E. The Top Scorer F. Inversion Expectation G. Lucky Tickets 原文地址:https://www.cnblogs.com/xht37/p/10198321.html