結果
問題 | No.894 二種類のバス |
ユーザー |
|
提出日時 | 2018-02-21 07:42:51 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 134 ms / 1,000 ms |
コード長 | 695 bytes |
コンパイル時間 | 2,253 ms |
コンパイル使用メモリ | 75,272 KB |
実行使用メモリ | 54,272 KB |
最終ジャッジ日時 | 2024-09-14 08:33:42 |
合計ジャッジ時間 | 5,848 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
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));}}