結果

問題 No.1509 Swap!!
ユーザー 遭難者遭難者
提出日時 2021-04-06 22:01:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 842 ms / 2,000 ms
コード長 537 bytes
コンパイル時間 2,211 ms
コンパイル使用メモリ 73,428 KB
実行使用メモリ 66,984 KB
最終ジャッジ日時 2023-10-11 09:24:52
合計ジャッジ時間 26,966 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,932 KB
testcase_01 AC 154 ms
55,720 KB
testcase_02 AC 817 ms
65,564 KB
testcase_03 AC 794 ms
65,492 KB
testcase_04 AC 815 ms
65,632 KB
testcase_05 AC 746 ms
65,604 KB
testcase_06 AC 807 ms
64,696 KB
testcase_07 AC 776 ms
65,732 KB
testcase_08 AC 808 ms
65,208 KB
testcase_09 AC 763 ms
65,892 KB
testcase_10 AC 826 ms
65,452 KB
testcase_11 AC 739 ms
65,796 KB
testcase_12 AC 735 ms
65,588 KB
testcase_13 AC 796 ms
65,724 KB
testcase_14 AC 767 ms
65,616 KB
testcase_15 AC 762 ms
65,348 KB
testcase_16 AC 826 ms
65,832 KB
testcase_17 AC 785 ms
65,228 KB
testcase_18 AC 781 ms
65,468 KB
testcase_19 AC 793 ms
65,364 KB
testcase_20 AC 768 ms
65,196 KB
testcase_21 AC 760 ms
64,492 KB
testcase_22 AC 794 ms
65,800 KB
testcase_23 AC 824 ms
65,996 KB
testcase_24 AC 835 ms
66,984 KB
testcase_25 AC 816 ms
65,884 KB
testcase_26 AC 842 ms
65,592 KB
testcase_27 AC 683 ms
64,836 KB
testcase_28 AC 759 ms
65,364 KB
testcase_29 AC 725 ms
65,180 KB
testcase_30 AC 741 ms
65,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

public class Main {
    public static void main(String[] args) {
        var sc = new java.util.Scanner(System.in);
        var ou = new java.io.PrintWriter(System.out);
        int t = sc.nextInt();
        for(int $ = 0 ; $ < t ; $++){
            long n = sc.nextLong();
            long a = sc.nextLong();
            long b = sc.nextLong();
            ou.println(a + b <= n + 1 && g(a, b) == 1 ? "YES" : "NO");
        }
        ou.flush();
    }
    static long g(long a, long b) {
        return b == 0 ? a : g(b, a % b);
    }
}
0