結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
55,976 KB
testcase_01 AC 111 ms
56,096 KB
testcase_02 AC 111 ms
55,960 KB
testcase_03 AC 106 ms
56,132 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 167 ms
58,284 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 167 ms
58,780 KB
testcase_12 AC 180 ms
58,740 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 174 ms
58,244 KB
testcase_19 WA -
testcase_20 AC 170 ms
58,272 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 176 ms
58,480 KB
testcase_24 AC 168 ms
58,968 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