結果

問題 No.894 二種類のバス
ユーザー tanimani364tanimani364
提出日時 2021-03-29 18:24:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 161 ms / 1,000 ms
コード長 435 bytes
コンパイル時間 437 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 80,912 KB
最終ジャッジ日時 2023-08-19 16:46:25
合計ジャッジ時間 5,087 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 158 ms
80,784 KB
testcase_01 AC 159 ms
80,896 KB
testcase_02 AC 161 ms
80,872 KB
testcase_03 AC 160 ms
80,804 KB
testcase_04 AC 157 ms
80,780 KB
testcase_05 AC 158 ms
80,672 KB
testcase_06 AC 156 ms
80,724 KB
testcase_07 AC 157 ms
80,676 KB
testcase_08 AC 157 ms
80,672 KB
testcase_09 AC 156 ms
80,912 KB
testcase_10 AC 158 ms
80,668 KB
testcase_11 AC 156 ms
80,784 KB
testcase_12 AC 156 ms
80,840 KB
testcase_13 AC 160 ms
80,636 KB
testcase_14 AC 158 ms
80,668 KB
testcase_15 AC 158 ms
80,900 KB
testcase_16 AC 159 ms
80,808 KB
testcase_17 AC 159 ms
80,484 KB
testcase_18 AC 159 ms
80,812 KB
testcase_19 AC 159 ms
80,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
#coding:utf-8

import math
import string
import random
import heapq
from sys import stdin
# import numpy as np
# from matplotlib import pyplot as plt

def gcd(a,b):
	while b>0:
		t=a
		a=b
		b=t%b
	
	return a
def lcm(a,b):
	return a//gcd(a,b)*b
def main():
	read=stdin.readline

	#edit here!
	t,a,b=map(int,read().split())
	ans=(t-1)//a+(t-1)//b+1-(t-1)//lcm(a,b)
	print(ans)

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