結果

問題 No.894 二種類のバス
ユーザー 37zigen37zigen
提出日時 2018-02-21 07:42:51
言語 Java21
(openjdk 21)
結果
AC  
実行時間 119 ms / 1,000 ms
コード長 695 bytes
コンパイル時間 1,948 ms
コンパイル使用メモリ 72,192 KB
実行使用メモリ 56,668 KB
最終ジャッジ日時 2023-10-12 09:38:16
合計ジャッジ時間 6,192 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
56,292 KB
testcase_01 AC 117 ms
55,524 KB
testcase_02 AC 119 ms
56,024 KB
testcase_03 AC 116 ms
56,288 KB
testcase_04 AC 115 ms
55,964 KB
testcase_05 AC 116 ms
55,608 KB
testcase_06 AC 117 ms
56,024 KB
testcase_07 AC 116 ms
55,684 KB
testcase_08 AC 115 ms
55,312 KB
testcase_09 AC 115 ms
56,404 KB
testcase_10 AC 114 ms
56,028 KB
testcase_11 AC 114 ms
55,756 KB
testcase_12 AC 114 ms
56,216 KB
testcase_13 AC 114 ms
56,668 KB
testcase_14 AC 114 ms
54,496 KB
testcase_15 AC 114 ms
55,496 KB
testcase_16 AC 116 ms
55,752 KB
testcase_17 AC 115 ms
55,792 KB
testcase_18 AC 116 ms
55,800 KB
testcase_19 AC 116 ms
55,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		BigInteger T = new BigInteger(sc.next()).subtract(BigInteger.ONE);
		BigInteger A = new BigInteger(sc.next());
		BigInteger B = new BigInteger(sc.next());
		BigInteger ans = BigInteger.ZERO;
		ans = ans.add(T.divide(A));
		ans = ans.add(T.divide(B));
		ans = ans.subtract(T.divide(A.multiply(B).divide(A.gcd(B))));
		ans = ans.add(BigInteger.ONE);
		System.out.println(ans);
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}
0