結果
問題 | No.894 二種類のバス |
ユーザー |
|
提出日時 | 2019-09-27 22:03:31 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 28 ms / 1,000 ms |
コード長 | 353 bytes |
コンパイル時間 | 252 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-09-24 13:10:37 |
合計ジャッジ時間 | 1,454 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
def gcd(a,b): if b == 0: return a else: return gcd(b, a % b) def lcm(a,b): if a*b == 0: return 0 else: return a // gcd(a,b) * b t,a,b = map(int,input().split()) c = lcm(a,b) sum = 0 sum += t//a+(1 if t%a!=0 else 0) sum += t//b+(1 if t%b!=0 else 0) sum -= t//c+(1 if t%c!=0 else 0) print(sum)