結果

問題 No.894 二種類のバス
ユーザー alexara1123alexara1123
提出日時 2019-09-27 22:20:42
言語 PyPy3
(7.3.15)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 585 bytes
コンパイル時間 1,009 ms
コンパイル使用メモリ 81,728 KB
実行使用メモリ 87,772 KB
最終ジャッジ日時 2023-10-24 22:34:06
合計ジャッジ時間 4,309 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from fractions import gcd
from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter
import sys
from bisect import *
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7


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

def main():
    t, a, b = map(int, input().split())
    aa = t // a
    if t % a != 0:
        aa += 1
    bb = t // b
    if t % b != 0:
        bb+=1
    cc = t // lcm(a, b)
    if t % lcm(a,b) != 0 :
        cc += 1
    #print(aa, bb, cc)

        
    print(aa + bb  - cc)


if __name__ == '__main__':
    main()
0