結果

問題 No.633 バスの運賃
ユーザー iehniehn
提出日時 2018-01-19 21:31:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 803 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 10,708 KB
実行使用メモリ 10,572 KB
最終ジャッジ日時 2023-08-26 00:02:23
合計ジャッジ時間 1,308 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,432 KB
testcase_01 AC 29 ms
10,560 KB
testcase_02 AC 28 ms
10,560 KB
testcase_03 AC 33 ms
10,520 KB
testcase_04 AC 28 ms
10,368 KB
testcase_05 AC 30 ms
10,432 KB
testcase_06 AC 30 ms
10,360 KB
testcase_07 AC 29 ms
10,460 KB
testcase_08 AC 29 ms
10,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    a = [I() for _ in range(n-1)] + [0]
    t = [LI() for _ in range(n)]
    r = 0
    k = 0
    for (b,c),ai in zip(t,a):
        k -= b
        k += c
        r += ai * k

    return r

print(main())


0