結果

問題 No.2558 中国剰余定理
ユーザー loop0919loop0919
提出日時 2023-11-14 09:47:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 160 ms / 2,000 ms
コード長 445 bytes
コンパイル時間 2,098 ms
コンパイル使用メモリ 74,248 KB
実行使用メモリ 58,136 KB
最終ジャッジ日時 2023-11-14 09:47:27
合計ジャッジ時間 7,482 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
57,856 KB
testcase_01 AC 126 ms
57,960 KB
testcase_02 AC 137 ms
57,832 KB
testcase_03 AC 126 ms
58,092 KB
testcase_04 AC 160 ms
57,848 KB
testcase_05 AC 125 ms
57,832 KB
testcase_06 AC 125 ms
58,136 KB
testcase_07 AC 125 ms
57,892 KB
testcase_08 AC 135 ms
57,964 KB
testcase_09 AC 116 ms
56,668 KB
testcase_10 AC 119 ms
56,844 KB
testcase_11 AC 130 ms
57,876 KB
testcase_12 AC 130 ms
57,952 KB
testcase_13 AC 114 ms
56,720 KB
testcase_14 AC 115 ms
56,732 KB
testcase_15 AC 130 ms
57,852 KB
testcase_16 AC 137 ms
57,712 KB
testcase_17 AC 129 ms
57,848 KB
testcase_18 AC 126 ms
54,772 KB
testcase_19 AC 141 ms
57,956 KB
testcase_20 AC 130 ms
57,892 KB
testcase_21 AC 139 ms
57,956 KB
testcase_22 AC 130 ms
57,968 KB
testcase_23 AC 130 ms
55,884 KB
testcase_24 AC 127 ms
56,840 KB
testcase_25 AC 144 ms
58,020 KB
testcase_26 AC 127 ms
57,876 KB
testcase_27 AC 127 ms
57,860 KB
testcase_28 AC 137 ms
58,020 KB
testcase_29 AC 124 ms
57,864 KB
testcase_30 AC 131 ms
57,960 KB
testcase_31 AC 126 ms
57,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int A = sc.nextInt();
        int B = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        for (int x = 0; true; x++) {
            if (x % A == a && x % B == b) {
                System.out.println(x);
                return;
            }
        }
    }
}
0