結果

問題 No.4 おもりと天秤
ユーザー fal_rndfal_rnd
提出日時 2017-01-20 18:49:19
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 398 bytes
コンパイル時間 3,491 ms
コンパイル使用メモリ 72,984 KB
実行使用メモリ 57,984 KB
最終ジャッジ日時 2023-08-24 18:20:18
合計ジャッジ時間 7,214 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,896 KB
testcase_01 AC 122 ms
56,044 KB
testcase_02 AC 124 ms
55,500 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 134 ms
55,848 KB
testcase_06 AC 122 ms
55,764 KB
testcase_07 AC 132 ms
56,188 KB
testcase_08 AC 131 ms
55,720 KB
testcase_09 AC 132 ms
55,788 KB
testcase_10 AC 132 ms
56,016 KB
testcase_11 AC 123 ms
57,984 KB
testcase_12 AC 123 ms
55,872 KB
testcase_13 AC 118 ms
55,772 KB
testcase_14 AC 123 ms
55,756 KB
testcase_15 AC 122 ms
55,728 KB
testcase_16 AC 122 ms
55,756 KB
testcase_17 WA -
testcase_18 AC 131 ms
55,500 KB
testcase_19 AC 131 ms
55,820 KB
testcase_20 AC 131 ms
55,856 KB
testcase_21 AC 131 ms
55,824 KB
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package src;

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