結果
| 問題 |
No.894 二種類のバス
|
| コンテスト | |
| ユーザー |
tails1434
|
| 提出日時 | 2019-12-27 22:17:16 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 366 bytes |
| コンパイル時間 | 771 ms |
| コンパイル使用メモリ | 82,040 KB |
| 実行使用メモリ | 89,172 KB |
| 最終ジャッジ日時 | 2024-10-09 13:45:33 |
| 合計ジャッジ時間 | 4,187 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 3 |
| other | RE * 17 |
ソースコード
from fractions import gcd
def lcm(a, b):
return a * b / gcd(a, b)
def main():
T, A, B = map(int, input().split())
C = int(lcm(A, B))
cnt1 = T // A - 1 if T % A == 0 else T // A
cnt2 = T // B - 1 if T % B == 0 else T // B
cnt3 = T // C - 1 if T % C == 0 else T // C
print(cnt1 + cnt2 - cnt3 + 1)
if __name__ == "__main__":
main()
tails1434