結果

問題 No.4 おもりと天秤
ユーザー m2543315647
提出日時 2015-05-13 11:58:45
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 386 bytes
コンパイル時間 4,008 ms
コンパイル使用メモリ 75,248 KB
実行使用メモリ 42,128 KB
最終ジャッジ日時 2024-07-06 01:16:16
合計ジャッジ時間 7,553 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;
public class No4 {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int[] w=new int[sc.nextInt()];
		int l=0,r=0;
		for(int i=0;i<w.length;i++)w[i]=sc.nextInt();
		Arrays.sort(w);
		for(int i=w.length-1;i>=0;i--)
		if(l<r)l+=w[i];
		else r+=w[i];
		System.out.println(l==r?"possible":"impossible");
	}
}
0