結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
57,828 KB
testcase_01 AC 138 ms
57,860 KB
testcase_02 AC 124 ms
57,992 KB
testcase_03 AC 124 ms
57,864 KB
testcase_04 AC 124 ms
57,772 KB
testcase_05 AC 125 ms
58,008 KB
testcase_06 AC 125 ms
57,944 KB
testcase_07 AC 113 ms
56,732 KB
testcase_08 AC 113 ms
54,776 KB
testcase_09 AC 126 ms
57,868 KB
testcase_10 AC 143 ms
58,008 KB
testcase_11 AC 113 ms
56,712 KB
testcase_12 AC 114 ms
56,716 KB
testcase_13 AC 115 ms
56,712 KB
testcase_14 AC 114 ms
56,748 KB
testcase_15 AC 113 ms
56,732 KB
testcase_16 AC 126 ms
57,880 KB
testcase_17 AC 124 ms
57,868 KB
testcase_18 AC 125 ms
57,868 KB
testcase_19 AC 146 ms
57,816 KB
testcase_20 AC 125 ms
57,804 KB
testcase_21 AC 125 ms
57,896 KB
testcase_22 AC 125 ms
57,888 KB
testcase_23 AC 130 ms
57,876 KB
testcase_24 AC 127 ms
57,772 KB
testcase_25 AC 124 ms
57,864 KB
testcase_26 AC 125 ms
57,680 KB
testcase_27 AC 151 ms
57,848 KB
testcase_28 AC 125 ms
57,696 KB
testcase_29 AC 114 ms
56,736 KB
testcase_30 AC 132 ms
58,004 KB
testcase_31 AC 133 ms
57,816 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 = a; true; x += A) {
            if (x % B == b) {
                System.out.println(x);
                return;
            }
        }
    }
}
0