結果

問題 No.1486 ロボット
ユーザー ayaoniayaoni
提出日時 2021-04-23 21:25:31
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 682 bytes
コンパイル時間 309 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 84,056 KB
最終ジャッジ日時 2023-09-17 11:39:48
合計ジャッジ時間 2,926 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,288 KB
testcase_01 AC 74 ms
71,392 KB
testcase_02 AC 73 ms
71,400 KB
testcase_03 AC 73 ms
71,440 KB
testcase_04 AC 74 ms
71,328 KB
testcase_05 AC 73 ms
71,316 KB
testcase_06 AC 93 ms
84,056 KB
testcase_07 AC 91 ms
83,864 KB
testcase_08 AC 84 ms
79,916 KB
testcase_09 AC 74 ms
71,664 KB
testcase_10 AC 81 ms
76,592 KB
testcase_11 AC 82 ms
76,556 KB
testcase_12 AC 81 ms
76,144 KB
testcase_13 AC 73 ms
71,228 KB
testcase_14 AC 86 ms
79,268 KB
testcase_15 AC 83 ms
76,640 KB
testcase_16 AC 82 ms
77,884 KB
testcase_17 AC 83 ms
77,596 KB
testcase_18 AC 83 ms
77,232 KB
testcase_19 AC 81 ms
76,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from math import gcd
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


A,B,C,D,E = MI()

X = (A+B)*(C+D)//gcd(A+B,C+D)
Y = [0]*X
for i in range(X):
    r = i % (A+B)
    s = i % (C+D)
    if r < A and s < C:
        Y[i] = 1

q,r = divmod(E,X)
ans = q*sum(Y)+sum(Y[:r])
print(ans)
0