結果

問題 No.1486 ロボット
ユーザー hiragnhiragn
提出日時 2022-11-19 17:45:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 390 bytes
コンパイル時間 417 ms
コンパイル使用メモリ 11,876 KB
実行使用メモリ 25,528 KB
最終ジャッジ日時 2023-10-20 23:03:24
合計ジャッジ時間 2,492 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,176 KB
testcase_01 AC 31 ms
10,176 KB
testcase_02 AC 31 ms
10,176 KB
testcase_03 AC 30 ms
10,176 KB
testcase_04 AC 30 ms
10,176 KB
testcase_05 AC 30 ms
10,176 KB
testcase_06 AC 199 ms
25,528 KB
testcase_07 AC 200 ms
25,528 KB
testcase_08 WA -
testcase_09 AC 32 ms
10,180 KB
testcase_10 AC 43 ms
11,152 KB
testcase_11 WA -
testcase_12 AC 32 ms
10,236 KB
testcase_13 WA -
testcase_14 AC 92 ms
14,516 KB
testcase_15 AC 41 ms
10,888 KB
testcase_16 AC 51 ms
12,472 KB
testcase_17 AC 56 ms
11,680 KB
testcase_18 AC 52 ms
12,208 KB
testcase_19 AC 37 ms
10,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math


def main():
    a, b, c, d, e = map(int, input().split())

    cycle = (a + b) * (c + d) // math.gcd(a + b, c + d)
    dp = [0] * (cycle + 1)
    for i in range(cycle):
        if 0 <= i % (a + b) < a and 0 <= i % (c + d) < c:
            dp[i + 1] = 1

    q, r = divmod(e, cycle)
    ans = q * sum(dp[:]) + sum(dp[:r])
    print(ans)


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