結果

問題 No.633 バスの運賃
ユーザー No
提出日時 2018-01-19 23:12:26
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 723 bytes
コンパイル時間 1,033 ms
コンパイル使用メモリ 103,552 KB
実行使用メモリ 17,920 KB
最終ジャッジ日時 2024-12-24 12:51:52
合計ジャッジ時間 1,535 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace y
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            var a = new int[n];
            a[0] = 0;
            for (int i = 0; i < n - 1; i++)
            {
                a[i + 1] = int.Parse(Console.ReadLine());
            }

            int r = 0;
            int t = 0;
            for (int i = 0; i < n; i++)
            {
                string[] s = Console.ReadLine().Split();
                int b = int.Parse(s[0]);
                int c = int.Parse(s[1]);
                t += r * a[i];
                r -= b;
                r += c;
            }

            Console.WriteLine(t);
        }
    }
}
0