Split Stones Problem Solution

Anonymous
java
02/12/2026 6:55 PM
1.0 KB
14
Indexable
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int t = sc.nextInt();
        
        while (t-- > 0) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            int c = sc.nextInt();
            int x = sc.nextInt();
            int y = sc.nextInt();
            if ((a + b + c) != (x + y)) {
                System.out.println("NO");
            } else {
                if (y < Math.min(a, Math.min(b, c)) || x < Math.min(a, Math.min(b, c))) {
                    System.out.println("NO");
                } else {
                    System.out.println("YES");
                }
            }
        }
        
        sc.close();  
    }
}
 
Editor is loading...
Leave a Comment