結果

問題 No.1486 ロボット
ユーザー moharan627moharan627
提出日時 2021-04-23 22:19:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 167 ms / 2,000 ms
コード長 766 bytes
コンパイル時間 540 ms
コンパイル使用メモリ 10,824 KB
実行使用メモリ 8,388 KB
最終ジャッジ日時 2023-09-17 12:28:45
合計ジャッジ時間 2,472 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,320 KB
testcase_01 AC 16 ms
8,388 KB
testcase_02 AC 16 ms
8,184 KB
testcase_03 AC 17 ms
8,228 KB
testcase_04 AC 16 ms
8,228 KB
testcase_05 AC 16 ms
8,124 KB
testcase_06 AC 166 ms
8,264 KB
testcase_07 AC 167 ms
8,248 KB
testcase_08 AC 84 ms
8,368 KB
testcase_09 AC 17 ms
8,192 KB
testcase_10 AC 27 ms
8,328 KB
testcase_11 AC 27 ms
8,324 KB
testcase_12 AC 17 ms
8,188 KB
testcase_13 AC 17 ms
8,252 KB
testcase_14 AC 87 ms
8,340 KB
testcase_15 AC 26 ms
8,336 KB
testcase_16 AC 35 ms
8,360 KB
testcase_17 AC 45 ms
8,212 KB
testcase_18 AC 32 ms
8,208 KB
testcase_19 AC 22 ms
8,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10 ** 6)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LC(): return list(input())
def IC(): return [int(c) for c in input()]
def MI(): return map(int, sys.stdin.readline().split())
INF = float('inf')
MOD = 10**9 + 7
def solve():
    A,B,C,D,E = MI()
    import math
    def my_lcm(x, y):
        return (x * y) // math.gcd(x, y)
    Loop = my_lcm(A+B,C+D)
    Same = 0
    for l in range(Loop):
        if(l%(A+B) <= A-1 and l%(C+D) <= C-1):
            Same+=1
    Ans = Same*(E//Loop)
    E = E - (E//Loop) * Loop#残り部分
    #print(Ans,E)
    for l in range(E):
        if(l%(A+B) <= A-1 and l%(C+D) <= C-1):
            Ans+=1
    print(Ans)
    return
solve()
0