結果

問題 No.633 バスの運賃
ユーザー maspymaspy
提出日時 2020-01-29 21:18:17
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 349 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 7,924 KB
最終ジャッジ日時 2023-10-14 07:18:55
合計ジャッジ時間 1,021 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,696 KB
testcase_01 AC 16 ms
7,768 KB
testcase_02 AC 15 ms
7,776 KB
testcase_03 AC 15 ms
7,828 KB
testcase_04 AC 15 ms
7,836 KB
testcase_05 AC 14 ms
7,872 KB
testcase_06 AC 15 ms
7,784 KB
testcase_07 AC 15 ms
7,768 KB
testcase_08 AC 14 ms
7,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

N = int(readline())
A = tuple(int(readline()) for _ in range(N-1))
m = map(int,read().split())
B,C = zip(*zip(m,m))

A

B,C

x = 0
answer = 0
for a,b,c in zip(A,B[1:],C[:-1]):
    x += c
    answer += a * x
    x -= b

print(answer)
0