結果
問題 | No.633 バスの運賃 |
ユーザー | YamaKasa |
提出日時 | 2018-09-30 16:30:09 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 142 ms / 2,000 ms |
コード長 | 554 bytes |
コンパイル時間 | 2,373 ms |
コンパイル使用メモリ | 74,980 KB |
実行使用メモリ | 54,400 KB |
最終ジャッジ日時 | 2024-04-20 13:40:58 |
合計ジャッジ時間 | 3,504 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 115 ms
54,104 KB |
testcase_01 | AC | 120 ms
54,200 KB |
testcase_02 | AC | 124 ms
54,400 KB |
testcase_03 | AC | 133 ms
54,324 KB |
testcase_04 | AC | 142 ms
54,036 KB |
testcase_05 | AC | 112 ms
54,164 KB |
testcase_06 | AC | 104 ms
52,884 KB |
testcase_07 | AC | 119 ms
54,032 KB |
testcase_08 | AC | 109 ms
52,988 KB |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int[]a = new int[n]; int[]b = new int[n]; int[]c = new int[n]; for(int i = 0; i < n - 1; i++) { a[i] = scan.nextInt(); } for(int i = 0; i < n; i++) { b[i] = scan.nextInt(); c[i] = scan.nextInt(); } scan.close(); int sum = 0; int B = 0; int C = 0; for(int i = 0; i < n; i++) { B += b[i]; C += c[i]; sum += a[i] * (C - B); } System.out.println(sum); } }