結果

問題 No.894 二種類のバス
ユーザー hedwig100
提出日時 2020-04-12 19:43:58
言語 Python3
(3.15.2 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 21 ms / 1,000 ms
+ 655µs
コード長 336 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 56 ms
コンパイル使用メモリ 15,104 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2026-10-12 15:28:59
合計ジャッジ時間 1,765 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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