結果
問題 | No.633 バスの運賃 |
ユーザー | denderaKawazu |
提出日時 | 2018-02-15 09:48:13 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 154 ms / 2,000 ms |
コード長 | 1,264 bytes |
コンパイル時間 | 3,664 ms |
コンパイル使用メモリ | 74,192 KB |
実行使用メモリ | 56,424 KB |
最終ジャッジ日時 | 2023-08-26 20:12:46 |
合計ジャッジ時間 | 4,283 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 128 ms
55,800 KB |
testcase_01 | AC | 133 ms
55,824 KB |
testcase_02 | AC | 133 ms
55,776 KB |
testcase_03 | AC | 140 ms
56,300 KB |
testcase_04 | AC | 154 ms
56,220 KB |
testcase_05 | AC | 127 ms
56,424 KB |
testcase_06 | AC | 127 ms
55,660 KB |
testcase_07 | AC | 132 ms
55,996 KB |
testcase_08 | AC | 131 ms
55,468 KB |
ソースコード
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; Scanner in = new Scanner(inputStream); PrintWriter out = new PrintWriter(outputStream); Task solver = new Task(); solver.solve(1, in, out); out.close(); } static class Task { public void solve(int testNumber, Scanner in, PrintWriter out) { final int n = in.nextInt(); int[] a = new int[n - 1]; for (int i = 0; i < n - 1; i++) { a[i] = in.nextInt(); } int[] bc = new int[n]; for (int i = 0; i < n; i++) { int b = in.nextInt(); int c = in.nextInt(); bc[i] = c - b; } int ans = 0; int p = bc[0]; for (int i = 1; i < n; i++) { ans += a[i - 1] * p; p += bc[i]; } out.println(ans); } } }