結果

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

ソースコード

diff #

MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from math import gcd

def lcm(a,b):
    return a*b//gcd(a,b)

def main():
    t,a,b = map(int,input().split())
    t -= 1
    g = lcm(a,b)
    ans = t//a + t//b - t//g + 1
    print(ans)
if __name__ =='__main__':
    main()   
0