結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
inudog_shiro
|
| 提出日時 | 2018-06-20 23:18:37 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 423 bytes |
| コンパイル時間 | 437 ms |
| コンパイル使用メモリ | 54,952 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-30 17:28:38 |
| 合計ジャッジ時間 | 1,205 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
#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 (sum % 2 == 0 && judge[sum / 2]) {
cout << "possible" << endl;
}
else {
cout << "impossible" << endl;
}
return 0;
}
inudog_shiro