結果

問題 No.1486 ロボット
ユーザー Ultimate_Tea_04Ultimate_Tea_04
提出日時 2021-04-23 21:33:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 473 ms / 2,000 ms
コード長 380 bytes
コンパイル時間 126 ms
コンパイル使用メモリ 10,792 KB
実行使用メモリ 15,776 KB
最終ジャッジ日時 2023-09-17 11:48:53
合計ジャッジ時間 2,993 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,784 KB
testcase_01 AC 17 ms
7,784 KB
testcase_02 AC 17 ms
7,836 KB
testcase_03 AC 16 ms
7,852 KB
testcase_04 AC 15 ms
7,804 KB
testcase_05 AC 16 ms
7,936 KB
testcase_06 AC 469 ms
15,728 KB
testcase_07 AC 473 ms
15,776 KB
testcase_08 AC 238 ms
11,952 KB
testcase_09 AC 16 ms
7,820 KB
testcase_10 AC 47 ms
8,488 KB
testcase_11 AC 48 ms
8,500 KB
testcase_12 AC 18 ms
7,832 KB
testcase_13 AC 16 ms
7,820 KB
testcase_14 AC 153 ms
11,192 KB
testcase_15 AC 41 ms
8,752 KB
testcase_16 AC 79 ms
9,540 KB
testcase_17 AC 71 ms
9,304 KB
testcase_18 AC 76 ms
9,024 KB
testcase_19 AC 33 ms
8,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def lcm(x,y):
    def gcd(x, y):
        if y == 0:
            return x
        else:
            return gcd(y,x%y)
    return (x*y)//gcd(x,y)

s = list(map(int,input().split()))
lc = lcm(s[0]+s[1],s[2]+s[3])
sec = [0]*lc
for i in range(0,lc):
    x = i%(s[0]+s[1])
    y = i%(s[2]+s[3])
    if x<s[0] and y<s[2]:
        sec[i] = 1
print(sum(sec)*(s[4]//lc)+sum(sec[:s[4]%lc]))
0