結果
| 問題 |
No.1486 ロボット
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-30 15:49:04 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 147 ms / 2,000 ms |
| コード長 | 927 bytes |
| コンパイル時間 | 159 ms |
| コンパイル使用メモリ | 82,428 KB |
| 実行使用メモリ | 88,832 KB |
| 最終ジャッジ日時 | 2024-07-18 12:49:56 |
| 合計ジャッジ時間 | 3,375 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
import collections
import decimal
import math
import sys
import time
#mod = 1_000_000_007
def resolve():
a,b,c,d,e = int1d()
gcd = math.gcd(a+b,c+d)
lcm = (a+b)*(c+d)//gcd
div,mod = divmod(e,lcm)
rest = 0
loop = 0
for i in range(lcm):
if mod==i: rest = loop
if i%(a+b)<a and i%(c+d)<c: loop += 1
print(div*loop+rest)
#region MyLibrary
#region Input
def str1d():return sys.stdin.read().splitlines()
def int1d():return list(map(int, sys.stdin.read().split()))
def float1d():return list(map(float,sys.stdin.read().split()))
def dec1d():return list(map(decimal.Decimal,sys.stdin.read().split()))
def str2d():return [list(s.split()) for s in str1d()]
def int2d():return [list(map(int,s.split())) for s in str1d()]
def float2d():return [list(map(float,s.split())) for s in str1d()]
def dec2d():return [list(map(decimal.Decimal,s.split())) for s in str1d()]
#endregion
resolve()