結果
| 問題 |
No.1486 ロボット
|
| コンテスト | |
| ユーザー |
paruf4
|
| 提出日時 | 2021-04-23 22:14:49 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 568 ms / 2,000 ms |
| コード長 | 641 bytes |
| コンパイル時間 | 145 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 34,176 KB |
| 最終ジャッジ日時 | 2024-07-04 08:11:43 |
| 合計ジャッジ時間 | 3,543 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
from math import gcd
a, b, c, d, e = map(int, input().split())
x = a+b
y = c+d
cycle = x*y//gcd(x, y)
memo1 = [0]*cycle
pos = 0
for i in range(cycle//x):
for j in range(a):
memo1[pos] = 1
pos += 1
for j in range(b):
pos += 1
memo2 = [0]*cycle
pos = 0
for i in range(cycle//y):
for j in range(c):
memo2[pos] = 1
pos += 1
for j in range(d):
pos += 1
memo = [0]*cycle
for i in range(cycle):
if memo1[i] == memo2[i] and memo1[i] == 1:
memo[i] = 1
cnt = sum(memo)
q, r = divmod(e, cycle)
res = q*cnt
for i in range(r):
if memo[i]:
res += 1
print(res)
paruf4