結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
youthfuldays072
|
| 提出日時 | 2018-05-04 11:00:55 |
| 言語 | Java (openjdk 23) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 566 bytes |
| コンパイル時間 | 1,946 ms |
| コンパイル使用メモリ | 74,812 KB |
| 実行使用メモリ | 56,404 KB |
| 最終ジャッジ日時 | 2024-06-28 00:59:10 |
| 合計ジャッジ時間 | 5,794 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 23 |
ソースコード
import java.util.Arrays;
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Main main=new Main();
main.run();
}
void run() {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int[] dp= new int[10001];
Arrays.fill(dp,1);
int sum=0;
for(int i=0;i<n;i++) {
int buf=sc.nextInt();
sum+=buf;
for(int j=10000;j>=0;j--) {
dp[j+buf]+=dp[j];
}
}
if(sum%2==1 || dp[sum/2]==1) {
System.out.println("impossible");
}else {
System.out.println("possible");
}
}
}
youthfuldays072