結果

問題 No.633 バスの運賃
コンテスト
ユーザー Pump0129
提出日時 2018-03-26 23:37:09
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 842 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,665 ms
コンパイル使用メモリ 82,776 KB
実行使用メモリ 47,120 KB
最終ジャッジ日時 2026-03-11 20:57:13
合計ジャッジ時間 2,835 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

package net.ipipip0129.yukicoder.no633;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int busStopCount = Integer.parseInt(scan.nextLine());
        int[] busStopMoney = new int[busStopCount - 1];

        for (int i = 0; i < busStopCount - 1; i++) busStopMoney[i] = Integer.parseInt(scan.nextLine());

        int busPassengers = Integer.parseInt(scan.nextLine().split(" ")[1]);
        int toalMonay = 0;

        for (int i = 0; i < busStopCount - 1; i++) {
            toalMonay += busStopMoney[i] * busPassengers;
            String[] data = scan.nextLine().split(" ");
            busPassengers += Integer.parseInt(data[1]) - Integer.parseInt(data[0]);
        }

        System.out.println(toalMonay);
    }
}
0