結果

問題 No.894 二種類のバス
ユーザー 双六
提出日時 2020-08-09 00:34:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 1,000 ms
コード長 442 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 82,572 KB
実行使用メモリ 54,016 KB
最終ジャッジ日時 2024-10-02 10:56:45
合計ジャッジ時間 1,900 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")
from math import gcd

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	T, A, B = getlist()
	GCD = gcd(A, B)
	LCM = int(A * B // GCD)
	ans = int((T - 1) // A + 1) + int((T - 1) // B + 1) - (int(T - 1) // LCM + 1)
	print(ans)

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