結果

問題 No.633 バスの運賃
ユーザー RisenRisen
提出日時 2018-01-19 21:34:10
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 762 bytes
コンパイル時間 2,122 ms
コンパイル使用メモリ 104,184 KB
実行使用メモリ 23,664 KB
最終ジャッジ日時 2023-08-26 00:03:08
合計ジャッジ時間 2,903 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
21,532 KB
testcase_01 AC 53 ms
21,624 KB
testcase_02 AC 53 ms
23,664 KB
testcase_03 AC 54 ms
21,600 KB
testcase_04 AC 55 ms
23,576 KB
testcase_05 AC 53 ms
21,604 KB
testcase_06 AC 53 ms
21,648 KB
testcase_07 AC 52 ms
21,636 KB
testcase_08 AC 50 ms
21,620 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

class Solution
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var a = new int[n];
        var b = new int[n];
        var c = new int[n];
        for (int i = 1; i < n; i++)
        {
            a[i] = int.Parse(Console.ReadLine());
        }
        for (int i = 0; i < n; i++)
        {
            var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            b[i] = vals[0];
            c[i] = vals[1];
        }

        int pay = 0;
        int customer = 0;
        for (int i = 0; i < n; i++)
        {
            pay += a[i] * customer;
            customer += c[i] - b[i];
        }

        Console.WriteLine(pay);
    }
}
0