結果
問題 |
No.633 バスの運賃
|
ユーザー |
![]() |
提出日時 | 2019-12-18 11:30:24 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 44 ms / 2,000 ms |
コード長 | 741 bytes |
コンパイル時間 | 1,942 ms |
コンパイル使用メモリ | 73,792 KB |
実行使用メモリ | 36,940 KB |
最終ジャッジ日時 | 2024-07-06 03:46:32 |
合計ジャッジ時間 | 2,583 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 |
ソースコード
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[] arr = new int[n]; for (int i = 0; i < n - 1; i++) { arr[i] = Integer.parseInt(br.readLine()); } int num = 0; long total = 0; for (int i = 0; i < n - 1; i++) { String[] line = br.readLine().split(" ", 2); int b = Integer.parseInt(line[0]); int c = Integer.parseInt(line[1]); num += c - b; total += num * arr[i]; } System.out.println(total); } }