結果

問題 No.1486 ロボット
ユーザー Super SolenoidSuper Solenoid
提出日時 2021-04-30 21:56:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 345 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 365 ms
コンパイル使用メモリ 10,980 KB
実行使用メモリ 29,700 KB
最終ジャッジ日時 2023-09-26 05:59:54
合計ジャッジ時間 6,885 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
29,592 KB
testcase_01 AC 133 ms
29,504 KB
testcase_02 AC 130 ms
29,488 KB
testcase_03 AC 131 ms
29,508 KB
testcase_04 AC 132 ms
29,568 KB
testcase_05 AC 130 ms
29,696 KB
testcase_06 AC 130 ms
29,548 KB
testcase_07 AC 345 ms
29,624 KB
testcase_08 AC 131 ms
29,604 KB
testcase_09 AC 132 ms
29,500 KB
testcase_10 AC 146 ms
29,568 KB
testcase_11 AC 145 ms
29,700 KB
testcase_12 AC 131 ms
29,612 KB
testcase_13 AC 131 ms
29,564 KB
testcase_14 AC 203 ms
29,420 KB
testcase_15 AC 143 ms
29,568 KB
testcase_16 AC 151 ms
29,504 KB
testcase_17 AC 163 ms
29,564 KB
testcase_18 AC 157 ms
29,608 KB
testcase_19 AC 138 ms
29,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
from numpy import floor
A, B, C, D, E = map(int, input().split())

n = A + B
m = C + D
L = int(n*m/gcd(n, m))
y = int(floor(E/L))
z = E - y*L
  
i = 0
j = 0
l = 0
if E < L:
    X = E + 1
else:
    X = L + 1

if z > 0:
    for i in range(1, z + 1):
        if 0 < i % n <= A and 0 < i % m <= C:
            j += 1
        else:
            None
else:
    None

for k in range(i + 1, X):
    if 0 < k % n <= A and 0 < k % m <= C:
        l += 1
    else:
        None
    
print(j + y*(j+l))
0