結果

問題 No.633 バスの運賃
ユーザー Pump0129
提出日時 2018-03-26 23:37:09
言語 Java
(openjdk 23)
結果
AC  
実行時間 168 ms / 2,000 ms
コード長 842 bytes
コンパイル時間 3,897 ms
コンパイル使用メモリ 74,712 KB
実行使用メモリ 42,016 KB
最終ジャッジ日時 2024-06-25 12:22:19
合計ジャッジ時間 4,641 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

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