結果

問題 No.894 二種類のバス
ユーザー Mcpu3
提出日時 2019-09-28 11:22:24
言語 Java
(openjdk 23)
結果
AC  
実行時間 136 ms / 1,000 ms
コード長 487 bytes
コンパイル時間 2,162 ms
コンパイル使用メモリ 74,680 KB
実行使用メモリ 54,056 KB
最終ジャッジ日時 2024-10-01 19:53:30
合計ジャッジ時間 5,209 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		BigInteger T = scanner.nextBigInteger(), A = scanner.nextBigInteger(), B = scanner.nextBigInteger();
		scanner.close();
		System.out.print(BigInteger.ONE.add(T.subtract(BigInteger.ONE).divide(A)).add(T.subtract(BigInteger.ONE).divide(B)).subtract(T.subtract(BigInteger.ONE).divide(A.multiply(B).divide(A.gcd(B)))));
	}
}
0