Competitive Programming Solutions

GitHub
back to dashboard

D. Ali Baba and Puzzles

Codeforces - Contest #1 · limit: 1s · memory: 256MB · view on codeforces

input

-432300451 509430974 -600857890 -220227239212711384

output

YES
Main.java
static void solve() {

        // Write your solution here
        long a = in.nextLong();
        long b = in.nextLong();
        long c = in.nextLong();
        long d = in.nextLong();

        if(a + b - c == d || a - b + c == d || a + b * c == d || a * b + c == d || a - b * c == d || a * b - c == d )
            out.print("YES");
        else
            out.print("NO");
    }