結果

問題 No.683 Two Operations No.3
ユーザー matsuyoshi30matsuyoshi30
提出日時 2018-05-12 00:18:36
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 872 bytes
コンパイル時間 3,000 ms
コンパイル使用メモリ 71,060 KB
実行使用メモリ 56,388 KB
最終ジャッジ日時 2023-09-10 18:05:28
合計ジャッジ時間 5,155 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 124 ms
56,388 KB
testcase_02 AC 124 ms
55,760 KB
testcase_03 AC 124 ms
55,236 KB
testcase_04 AC 124 ms
55,960 KB
testcase_05 AC 123 ms
56,176 KB
testcase_06 AC 125 ms
55,748 KB
testcase_07 AC 126 ms
55,772 KB
testcase_08 AC 123 ms
55,900 KB
testcase_09 AC 125 ms
55,672 KB
testcase_10 AC 126 ms
55,352 KB
testcase_11 WA -
testcase_12 AC 125 ms
55,872 KB
testcase_13 AC 124 ms
55,892 KB
testcase_14 WA -
testcase_15 AC 124 ms
55,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextLong();
        long b = in.nextLong();
        if(a > b) {
            long tmp = a;
            a = b;
            b = tmp;
        }

        String ans = "";
        if(a == 0) {
            ans = "Yes";
        } else if(a == 1) {
            if(b % 2 == 0)
                ans = "Yes";
            else
                ans = "No";
        } else if(a % 2 == 0) {
            if(b == 2) {
                ans = "No";
            } else if(b != 4 && a == b) {
                ans = "No";
            }else {
                ans = "Yes";
            }
        } else {
            if(b % 2 != 0)
                ans = "No";
            else
                ans = "Yes";
        }

        System.out.println(ans);
    }
}
0