結果
問題 | No.633 バスの運賃 |
ユーザー | Grenache |
提出日時 | 2018-01-20 20:46:35 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 156 ms / 2,000 ms |
コード長 | 894 bytes |
コンパイル時間 | 4,486 ms |
コンパイル使用メモリ | 74,096 KB |
実行使用メモリ | 55,960 KB |
最終ジャッジ日時 | 2023-08-26 09:24:35 |
合計ジャッジ時間 | 5,700 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 129 ms
55,804 KB |
testcase_01 | AC | 133 ms
55,704 KB |
testcase_02 | AC | 139 ms
55,804 KB |
testcase_03 | AC | 144 ms
55,960 KB |
testcase_04 | AC | 156 ms
55,776 KB |
testcase_05 | AC | 129 ms
55,752 KB |
testcase_06 | AC | 128 ms
55,676 KB |
testcase_07 | AC | 134 ms
55,556 KB |
testcase_08 | AC | 133 ms
55,544 KB |
ソースコード
import java.io.*; import java.util.*; public class Main_yukicoder633 { private static Scanner sc; private static Printer pr; private static void solve() { int n = sc.nextInt(); int[] a = new int[n - 1]; for (int i = 0; i < n - 1; i++) { a[i] = sc.nextInt(); } int[] b = new int[n]; int[] c = new int[n]; for (int i = 0; i < n; i++) { b[i] = sc.nextInt(); c[i] = sc.nextInt(); } int ans = 0; int num = 0; for (int i = 0; i < n; i++) { if (i > 0) { ans += num * a[i - 1]; } num += c[i]; num -= b[i]; } pr.println(ans); } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }