結果
問題 |
No.178 美しいWhitespace (1)
|
ユーザー |
![]() |
提出日時 | 2015-04-06 00:17:26 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 805 bytes |
コンパイル時間 | 4,297 ms |
コンパイル使用メモリ | 74,100 KB |
実行使用メモリ | 57,512 KB |
最終ジャッジ日時 | 2024-07-04 02:21:48 |
合計ジャッジ時間 | 7,006 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 7 WA * 14 |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner koko = new Scanner (System.in); int n = koko.nextInt(); int[] a = new int[n]; int[] b = new int[n]; for(int i =0; i<n; i++){ a[i] = koko.nextInt(); b[i] = koko.nextInt(); } int max=0; int[] white = new int[n]; for(int i =0; i<n; i++){ white[i] = a[i]+4*b[i]; max = Math.max(max,white[i]); } int need=0; for(int i=0; i<n; i++){ if((max-white[i])%2==0){ need = need + (max-white[i])/2; }else{ need = -1; break; } } System.out.println(need); } }