結果

問題 No.4 おもりと天秤
ユーザー m2543315647m2543315647
提出日時 2015-05-13 11:58:45
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 386 bytes
コンパイル時間 4,775 ms
コンパイル使用メモリ 72,380 KB
実行使用メモリ 56,180 KB
最終ジャッジ日時 2023-09-20 05:05:54
合計ジャッジ時間 8,853 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,568 KB
testcase_01 AC 127 ms
55,696 KB
testcase_02 AC 128 ms
55,788 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 135 ms
55,852 KB
testcase_06 AC 126 ms
55,780 KB
testcase_07 AC 135 ms
55,904 KB
testcase_08 AC 139 ms
55,968 KB
testcase_09 AC 137 ms
55,632 KB
testcase_10 AC 135 ms
55,684 KB
testcase_11 AC 125 ms
55,656 KB
testcase_12 AC 126 ms
56,180 KB
testcase_13 AC 127 ms
55,716 KB
testcase_14 AC 126 ms
55,812 KB
testcase_15 AC 126 ms
55,676 KB
testcase_16 AC 126 ms
55,572 KB
testcase_17 WA -
testcase_18 AC 134 ms
55,792 KB
testcase_19 AC 136 ms
55,912 KB
testcase_20 AC 138 ms
55,536 KB
testcase_21 AC 137 ms
55,800 KB
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

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