結果

問題 No.1486 ロボット
ユーザー mkawa2mkawa2
提出日時 2021-04-23 21:29:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 292 ms / 2,000 ms
コード長 859 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 10,968 KB
実行使用メモリ 16,224 KB
最終ジャッジ日時 2023-09-17 11:46:38
合計ジャッジ時間 2,360 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,472 KB
testcase_01 AC 18 ms
8,368 KB
testcase_02 AC 16 ms
8,424 KB
testcase_03 AC 16 ms
8,372 KB
testcase_04 AC 17 ms
8,416 KB
testcase_05 AC 17 ms
8,472 KB
testcase_06 AC 284 ms
16,224 KB
testcase_07 AC 292 ms
16,180 KB
testcase_08 AC 141 ms
12,288 KB
testcase_09 AC 17 ms
8,468 KB
testcase_10 AC 37 ms
8,996 KB
testcase_11 AC 36 ms
8,972 KB
testcase_12 AC 18 ms
8,388 KB
testcase_13 AC 17 ms
8,408 KB
testcase_14 AC 111 ms
11,580 KB
testcase_15 AC 33 ms
8,864 KB
testcase_16 AC 47 ms
9,852 KB
testcase_17 AC 53 ms
9,688 KB
testcase_18 AC 49 ms
9,452 KB
testcase_19 AC 26 ms
8,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.buffer.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def BI(): return sys.stdin.buffer.readline().rstrip()
def SI(): return sys.stdin.buffer.readline().rstrip().decode()
inf = 10 ** 16
md = 10 ** 9 + 7
# md = 998244353

from math import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

a, b, c, d, e = LI()
l = lcm(a + b, c + d)
cnt = [0] * l
for i in range(l):
    if i % (a + b) < a and i % (c + d) < c: cnt[i] = 1

p, r = divmod(e, l)
ans = sum(cnt) * p + sum(cnt[:r])
print(ans)
0