結果
| 問題 | No.1486 ロボット |
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 21:04:56 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 45 ms / 2,000 ms |
| コード長 | 525 bytes |
| 記録 | |
| コンパイル時間 | 185 ms |
| コンパイル使用メモリ | 82,408 KB |
| 実行使用メモリ | 62,940 KB |
| 最終ジャッジ日時 | 2025-03-20 21:05:10 |
| 合計ジャッジ時間 | 1,817 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
import math
A, B, C, D, E = map(int, input().split())
T1 = A + B
T2 = C + D
def compute_lcm(a, b):
return a * b // math.gcd(a, b)
lcm = compute_lcm(T1, T2)
# Compute the overlap in one full LCM cycle
S = 0
for t in range(lcm):
r1 = t % T1
r2 = t % T2
if r1 < A and r2 < C:
S += 1
q = E // lcm
remainder = E % lcm
# Compute the overlap in the remainder part
R = 0
for t in range(remainder):
r1 = t % T1
r2 = t % T2
if r1 < A and r2 < C:
R += 1
total = q * S + R
print(total)
lam6er