結果

問題 No.178 美しいWhitespace (1)
ユーザー chiho_miyakochiho_miyako
提出日時 2015-04-06 00:17:22
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 805 bytes
コンパイル時間 4,056 ms
コンパイル使用メモリ 72,040 KB
実行使用メモリ 60,768 KB
最終ジャッジ日時 2023-09-17 04:53:53
合計ジャッジ時間 9,866 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,684 KB
testcase_01 AC 126 ms
55,792 KB
testcase_02 AC 126 ms
55,912 KB
testcase_03 AC 126 ms
55,496 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 199 ms
58,580 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 196 ms
58,840 KB
testcase_12 AC 198 ms
58,632 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 197 ms
58,348 KB
testcase_19 WA -
testcase_20 AC 200 ms
58,460 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 201 ms
58,968 KB
testcase_24 AC 200 ms
58,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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);

    }
}
0