結果

問題 No.178 美しいWhitespace (1)
ユーザー mits58
提出日時 2016-07-02 15:18:21
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 466 bytes
コンパイル時間 2,045 ms
コンパイル使用メモリ 74,172 KB
実行使用メモリ 58,556 KB
最終ジャッジ日時 2024-10-12 00:50:44
合計ジャッジ時間 7,773 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 7 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			int n=sc.nextInt();
			int[] c=new int[n];
			int max=0;
			for(int i=0;i<n;i++){
				c[i]=sc.nextInt()+sc.nextInt()*4;
				max=Math.max(c[i],max);
			}
			int ans=0;
			for(int i=0;i<n;i++){
				if(ans==-1) break;
				if((max-c[i])%2==1) ans=-1;
				else ans+=(max-c[i])/2;
			}
			System.out.println(ans);
		}
	}
}
0