結果

問題 No.633 バスの運賃
ユーザー Pump0129Pump0129
提出日時 2018-03-26 23:37:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 141 ms / 2,000 ms
コード長 842 bytes
コンパイル時間 2,054 ms
コンパイル使用メモリ 72,012 KB
実行使用メモリ 56,008 KB
最終ジャッジ日時 2023-09-07 18:37:50
合計ジャッジ時間 3,901 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,528 KB
testcase_01 AC 118 ms
55,528 KB
testcase_02 AC 120 ms
55,948 KB
testcase_03 AC 123 ms
55,960 KB
testcase_04 AC 141 ms
55,760 KB
testcase_05 AC 119 ms
56,008 KB
testcase_06 AC 116 ms
55,264 KB
testcase_07 AC 118 ms
55,664 KB
testcase_08 AC 117 ms
55,892 KB
権限があれば一括ダウンロードができます

ソースコード

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