結果
問題 | No.894 二種類のバス |
ユーザー |
![]() |
提出日時 | 2020-05-11 04:46:46 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 48 ms / 1,000 ms |
コード長 | 341 bytes |
コンパイル時間 | 283 ms |
コンパイル使用メモリ | 82,160 KB |
実行使用メモリ | 56,608 KB |
最終ジャッジ日時 | 2024-07-16 02:54:45 |
合計ジャッジ時間 | 1,879 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
t, a, b = map(int, input().split()) #import fractions import math from functools import reduce def lcm_base(x, y): #return (x * y) // fractions.gcd(x, y) return (x * y) // math.gcd(x, y) def lcm_list(numbers): return reduce(lcm_base, numbers, 1) l = lcm_base(a, b) q, r = divmod(t-1, l) ans = q*(l//a+l//b-1)+r//a+r//b+1 print(ans)