Competitive Programming Solutions

GitHub
back to dashboard

B. Memo and Momo

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

input

15 7 3

output

Memo
Main.java
static void solve() {

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

        if(a % k == 0 || b % k == 0){
            if(a % k == 0 && b % k == 0){
                out.print("Both");
            }else if(a % k == 0){
                out.print("Memo");
            }else{
                out.print("Momo");
            }
        }else{
            out.print("No One");
        }
    }