結果

問題 No.4 おもりと天秤
ユーザー kimnykimny
提出日時 2018-05-30 12:20:03
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 407 bytes
コンパイル時間 640 ms
コンパイル使用メモリ 63,232 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 08:12:00
合計ジャッジ時間 1,569 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;

int n;
int w[100];
int sum = 0;
bool judge[10001] = { false };

int main() {
	cin >> n;
	judge[0] = true;
	for (int i = 0; i < n; i++) {
		cin >> w[i];
		sum += w[i];
		for (int j = 10000; j >= w[i]; j--) {
			if (judge[j - w[i]]) judge[j] = true;
		}
	}
	if (judge[sum / 2]) {
		cout << "possible" << endl;
	}
	else {
		cout << "impossible" << endl;
	}
	return 0;
}
0