Submission #15421437


Source Code Expand

Copy
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, *A = map(int, read().split())

kabu, yen = 0, 1000

for x, y in zip(A, A[1:] + [0]):
    # 円にもどす
    kabu, yen = 0, yen + x * kabu
    if x < y:
        # 買う
        kabu, yen = divmod(yen, x)

print(yen)

Submission Info

Submission Time
Task D - Road to Millionaire
User maspy
Language Python (3.8.2)
Score 400
Code Size 356 Byte
Status
Exec Time 32 ms
Memory 9184 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0
All 400 / 400 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 01-random-01.txt, 01-random-02.txt, 01-random-03.txt, 01-random-04.txt, 01-random-05.txt, 01-random-06.txt, 01-random-07.txt, 01-random-08.txt, 01-random-09.txt, 01-random-10.txt, 02-increasing-01.txt, 03-decreasing-01.txt, 04-large-01.txt, 04-large-02.txt, 04-large-03.txt, 05-maximum-01.txt, 05-maximum-02.txt, 05-maximum-03.txt
Case Name Status Exec Time Memory
00-sample-01.txt 21 ms 9184 KB
00-sample-02.txt 24 ms 8888 KB
00-sample-03.txt 20 ms 9116 KB
01-random-01.txt 31 ms 8892 KB
01-random-02.txt 29 ms 8888 KB
01-random-03.txt 32 ms 8848 KB
01-random-04.txt 29 ms 9056 KB
01-random-05.txt 29 ms 9056 KB
01-random-06.txt 26 ms 9056 KB
01-random-07.txt 24 ms 8888 KB
01-random-08.txt 21 ms 8888 KB
01-random-09.txt 27 ms 9180 KB
01-random-10.txt 23 ms 8992 KB
02-increasing-01.txt 21 ms 8888 KB
03-decreasing-01.txt 25 ms 8888 KB
04-large-01.txt 26 ms 9048 KB
04-large-02.txt 26 ms 8892 KB
04-large-03.txt 28 ms 9000 KB
05-maximum-01.txt 20 ms 9048 KB
05-maximum-02.txt 27 ms 9040 KB
05-maximum-03.txt 26 ms 9048 KB