結果

問題 No.2558 中国剰余定理
ユーザー viral8viral8
提出日時 2023-12-02 14:33:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 580 bytes
コンパイル時間 1,943 ms
コンパイル使用メモリ 73,904 KB
実行使用メモリ 55,172 KB
最終ジャッジ日時 2023-12-02 14:34:19
合計ジャッジ時間 5,189 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
54,120 KB
testcase_01 AC 54 ms
54,116 KB
testcase_02 AC 71 ms
54,768 KB
testcase_03 AC 53 ms
52,040 KB
testcase_04 AC 95 ms
55,012 KB
testcase_05 AC 53 ms
54,120 KB
testcase_06 AC 56 ms
54,116 KB
testcase_07 AC 54 ms
54,112 KB
testcase_08 AC 70 ms
54,776 KB
testcase_09 AC 55 ms
54,124 KB
testcase_10 AC 69 ms
54,892 KB
testcase_11 AC 68 ms
55,008 KB
testcase_12 AC 57 ms
54,108 KB
testcase_13 AC 55 ms
54,128 KB
testcase_14 AC 54 ms
54,124 KB
testcase_15 AC 59 ms
54,108 KB
testcase_16 AC 72 ms
54,776 KB
testcase_17 AC 55 ms
54,128 KB
testcase_18 AC 72 ms
54,764 KB
testcase_19 AC 76 ms
54,764 KB
testcase_20 AC 64 ms
54,124 KB
testcase_21 AC 71 ms
54,764 KB
testcase_22 AC 55 ms
54,112 KB
testcase_23 AC 56 ms
54,108 KB
testcase_24 AC 75 ms
54,756 KB
testcase_25 AC 73 ms
54,760 KB
testcase_26 AC 57 ms
54,080 KB
testcase_27 AC 57 ms
54,124 KB
testcase_28 AC 71 ms
54,888 KB
testcase_29 AC 55 ms
54,104 KB
testcase_30 AC 80 ms
55,172 KB
testcase_31 AC 59 ms
54,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
class Main{
	private static final BufferedReader br =
		new BufferedReader(new InputStreamReader(System.in));
	private static final PrintWriter out =
		new PrintWriter(System.out);
	public static void main(String[] args)throws IOException{

		String[] str = br.readLine().split(" ");
		int A = Integer.parseInt(str[0]);
		int B = Integer.parseInt(str[1]);
		int a = Integer.parseInt(str[2]);
		int b = Integer.parseInt(str[3]);
		for(int i=0;;i++)
			if(i%A==a&&i%B==b){
				out.println(i);
				break;
			}

		br.close();
		out.close();
	}
}
0