此题是一个思维题,可以看出题目的条件是比较苛刻的,可以通过模拟来得出满足的组合是很有限的,可以在小数内反复尝试得出答案,有一个办法可以将最大的周期是作一个区间,那我们的目标就是在每一个区间内将数给填满,其他两个周期也是做一个区间,可以进行模拟来观察
#include<iostream>
using namespace std;
int main()
{
    int T;
    cin>>T;
    while(T--)
    {
        int a[3];
        for(int i=0;i<3;i++)cin>>a[i];
        int cnt1=0,cnt2=0,cnt3=0,cnt4=0;
        for(int i=0;i<3;i++)
            if(a[i]==1)cnt1++;
            else if(a[i]==2)cnt2++;
            else if(a[i]==3)cnt3++;
            else if(a[i]==4)cnt4++;
        if(cnt1!=0||cnt2>=2||cnt3>=3||(cnt4==2&&cnt2==1))
            cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int T = scanner.nextInt();
        
        while (T-- > 0) {
            int[] a = new int[3];
            for (int i = 0; i < 3; i++) {
                a[i] = scanner.nextInt();
            }
            
            int cnt1 = 0, cnt2 = 0, cnt3 = 0, cnt4 = 0;
            for (int i = 0; i < 3; i++) {
                if (a[i] == 1)
                    cnt1++;
                else if (a[i] == 2)
                    cnt2++;
                else if (a[i] == 3)
                    cnt3++;
                else if (a[i] == 4)
                    cnt4++;
            }
            
            if (cnt1 != 0 || cnt2 >= 2 || cnt3 >= 3 || (cnt4 == 2 && cnt2 == 1))
                System.out.println("YES");
            else
                System.out.println("NO");
        }
        
        scanner.close();
    }
}
# 从标准输入读取数据
T = int(input())
for _ in range(T):
    # 读取三个整数到列表a
    a = list(map(int, input().split()))
    
    cnt1 = 0
    cnt2 = 0
    cnt3 = 0
    cnt4 = 0
    
    for num in a:
        if num == 1:
            cnt1 += 1
        elif num == 2:
            cnt2 += 1
        elif num == 3:
            cnt3 += 1
        elif num == 4:
            cnt4 += 1
    
    if cnt1 != 0 or cnt2 >= 2 or cnt3 >= 3 or (cnt4 == 2 and cnt2 == 1):
        print("YES")
    else:
        print("NO")
        小红有三个周期性的集合,他们的周期分别是a,b,c,周期为a代表的集合为{x2+n∗a∣n=0,1,2,...},周期为b代表的集合为{x2+n∗b∣n=0,1,2,...},周期为c代表的集合为{x3+n∗c∣n=0,1,2,...}。
求现在是否存在一组x1,x2,x3,可以使得这三个集合可以组成大于等于max{x1,x2,x3}的所有自然数。如果可以输出YSE,反之输出NO
第一行输入一个整数 t(1≤t≤10)表示测试数据数量。
每组数据的第一行三个整数a,b,c(1≤a,b,c≤1500)。
每组数据输出一行,如果可以输出YSE,反之输出NO
输入
3
4 3 10
6 3 6
2 2 2
输出
NO
NO
YES