結果
| 問題 |
No.178 美しいWhitespace (1)
|
| コンテスト | |
| ユーザー |
matsuyoshi30
|
| 提出日時 | 2016-02-05 21:00:14 |
| 言語 | Java (openjdk 23) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 606 bytes |
| コンパイル時間 | 2,060 ms |
| コンパイル使用メモリ | 74,588 KB |
| 実行使用メモリ | 41,420 KB |
| 最終ジャッジ日時 | 2024-09-21 20:41:11 |
| 合計ジャッジ時間 | 5,566 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 4 |
| other | RE * 21 |
ソースコード
import java.util.Scanner;
class Test {
public static void main(String[] args) throws Exception {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int a = 0, b = 0;
int[] w = new int[n];
int max = 0;
boolean bool = true;
for(int i=0; i<n; i++) {
a = in.nextInt();
b = in.nextInt();
w[i] = a + b * 4;
max = Math.max(max, w[i]);
if(w[i] % 2 != w[i-1] % 2) {
bool = false;
}
}
if(bool) {
int ans = 0;
for(int i=0; i<n; i++) {
ans += (max - w[i]) / 2;
}
System.out.println(ans);
} else {
System.out.println(-1);
}
}
}
matsuyoshi30