結果
問題 |
No.178 美しいWhitespace (1)
|
ユーザー |
![]() |
提出日時 | 2016-02-05 21:02:20 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 589 bytes |
コンパイル時間 | 2,143 ms |
コンパイル使用メモリ | 75,300 KB |
実行使用メモリ | 57,244 KB |
最終ジャッジ日時 | 2024-09-21 20:41:20 |
合計ジャッジ時間 | 7,146 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 7 WA * 14 |
ソースコード
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[] w = new int[n]; int max = 0; boolean bool = true; for(int i=0; i<n; i++) { int a = in.nextInt(); int b = in.nextInt(); w[i] = a + b * 4; max = Math.max(max, w[i]); if(i > 0 && 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); } } }