結果

問題 No.633 バスの運賃
ユーザー maimai
提出日時 2018-01-19 22:07:44
言語 Ruby
(3.3.0)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 200 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 11,500 KB
実行使用メモリ 15,308 KB
最終ジャッジ日時 2023-08-26 00:17:51
合計ジャッジ時間 1,437 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
15,176 KB
testcase_01 AC 74 ms
15,108 KB
testcase_02 AC 71 ms
15,308 KB
testcase_03 AC 72 ms
15,028 KB
testcase_04 AC 69 ms
15,172 KB
testcase_05 AC 68 ms
15,080 KB
testcase_06 AC 69 ms
15,144 KB
testcase_07 AC 68 ms
15,048 KB
testcase_08 AC 71 ms
15,136 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def ascan; gets.split.map(&:to_i);end


n = gets.to_i
a = (2..n).map{gets.to_i}

a.unshift 0

ans = 0
pas = 0
n.times do |i|
    b,c = ascan
    ans += pas*a[i]
    pas -= b
    pas += c
end


p ans

0