結果
問題 | No.633 バスの運賃 |
ユーザー |
![]() |
提出日時 | 2018-01-19 21:34:10 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 762 bytes |
コンパイル時間 | 1,045 ms |
コンパイル使用メモリ | 107,924 KB |
実行使用メモリ | 18,944 KB |
最終ジャッジ日時 | 2024-12-24 12:12:57 |
合計ジャッジ時間 | 1,794 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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); } }