結果

問題 No.894 二種類のバス
ユーザー ttr
提出日時 2020-02-04 11:00:28
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 33 ms / 1,000 ms
コード長 216 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-09-20 07:00:09
合計ジャッジ時間 1,493 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

T,A,B = map(int, input().split())

def gcd(a, b):
    if a < b:
        a,b = b,a
    if a % b == 0:
        return b
    return gcd(b, a%b)

lcm = A*B//gcd(A, B)
ans = (T-1)//A + (T-1)//B - (T-1)//lcm + 1
print(ans)
0