結果
問題 |
No.999 てん vs. ほむ
|
ユーザー |
![]() |
提出日時 | 2020-02-28 21:52:37 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 732 bytes |
コンパイル時間 | 2,286 ms |
コンパイル使用メモリ | 73,416 KB |
実行使用メモリ | 63,844 KB |
最終ジャッジ日時 | 2024-10-13 17:18:47 |
合計ジャッジ時間 | 6,715 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | WA * 6 TLE * 1 -- * 13 |
ソースコード
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(reader.readLine()); String[] str = reader.readLine().split(" "); int[] n = new int[2*N]; for (int i = 0; i < 2*N; i++) { n[i] = Integer.parseInt(str[i]); } int max = 0; for (int b = 0; b < N; b++) { //しきり int keep = 0; for (int a = 0; a < N; a++) { //中の数 if (a <= b) { keep += n[2*a] - n[2*a+1]; } else { keep += n[2*a+1] - n[2*a]; } } if (max < keep) { max = keep; } } System.out.println(max); } }