結果

問題 No.894 二種類のバス
ユーザー asdf1asdf1
提出日時 2019-09-27 22:22:06
言語 Python2
(2.7.18)
結果
AC  
実行時間 11 ms / 1,000 ms
コード長 348 bytes
コンパイル時間 472 ms
コンパイル使用メモリ 7,148 KB
実行使用メモリ 6,484 KB
最終ジャッジ日時 2023-10-24 22:52:45
合計ジャッジ時間 1,427 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

l = map(int, raw_input().split())

def gcd(a, b):
    if b > a:
        a, b = b, a
    if b == 0:
        return a
    return gcd(b, a%b)

t=l[0]
a=l[1]
b=l[2]

if t%a==0:
    ans=t/a;
else:
    ans=t/a+1;

if t%b==0:
    ans+=t/b;
else:
    ans+=t/b+1;

tmp=(a * b) // gcd(a, b)

if t%tmp==0:
    ans-=t/tmp;
else:
    ans-=t/tmp+1;

print(ans);
0