結果
| 問題 |
No.999 てん vs. ほむ
|
| コンテスト | |
| ユーザー |
non3kzx
|
| 提出日時 | 2020-02-28 22:23:32 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 758 bytes |
| コンパイル時間 | 1,995 ms |
| コンパイル使用メモリ | 75,072 KB |
| 実行使用メモリ | 64,076 KB |
| 最終ジャッジ日時 | 2024-10-13 17:54:58 |
| 合計ジャッジ時間 | 6,529 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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];
}
}
keep = Math.abs(keep);
if (keep > max) {
max = keep;
}
}
System.out.println(max);
}
}
non3kzx