結果

問題 No.1486 ロボット
ユーザー johnjohn
提出日時 2021-05-20 13:08:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 254 ms / 2,000 ms
コード長 1,052 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-18 14:02:15
合計ジャッジ時間 2,546 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,752 KB
testcase_01 AC 29 ms
10,752 KB
testcase_02 AC 34 ms
10,752 KB
testcase_03 AC 32 ms
10,752 KB
testcase_04 AC 29 ms
10,880 KB
testcase_05 AC 28 ms
10,752 KB
testcase_06 AC 28 ms
10,752 KB
testcase_07 AC 191 ms
10,752 KB
testcase_08 AC 28 ms
10,752 KB
testcase_09 AC 55 ms
10,752 KB
testcase_10 AC 254 ms
10,624 KB
testcase_11 AC 254 ms
10,752 KB
testcase_12 AC 107 ms
10,752 KB
testcase_13 AC 93 ms
10,752 KB
testcase_14 AC 107 ms
10,752 KB
testcase_15 AC 42 ms
10,752 KB
testcase_16 AC 52 ms
10,752 KB
testcase_17 AC 62 ms
10,752 KB
testcase_18 AC 88 ms
10,752 KB
testcase_19 AC 43 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding utf-8

def Input_func():
    data = input().split(" ")
    return data

def Time_count_func(time, a, b, c, d):
    section_time = 0
    for t in range(time):
        if t % (a + b) < a and t % (c + d) < c:
            section_time += 1
    return section_time


def Calc_func(data):
    a = int(data[0])
    b = int(data[1])
    c = int(data[2])
    d = int(data[3])
    e = int(data[4])

    section_time = 0
    cycle_num = 0
    dive_rem = 0
    answer = 0

    # cycle time
    time = ((a + b) * (d + c))

    # e < cycle time
    if e < time:
        time = e
        answer = Time_count_func(time, a, b, c, d)
    else:
        cycle_num = e // time
        dive_rem = e % time
        section_time = Time_count_func(time, a, b, c, d)
    
    if answer != 0:
        print(answer)
    else:
        answer = section_time * cycle_num
        answer += Time_count_func(dive_rem, a, b, c, d)
        print(answer)



def main():

    # data[0]~[4] is A~E
    data = Input_func()

    Calc_func(data)

if __name__ == '__main__':
    main()
0