結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
suppy193
|
| 提出日時 | 2016-07-07 16:49:37 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 440 bytes |
| コンパイル時間 | 118 ms |
| コンパイル使用メモリ | 21,376 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-12 23:15:12 |
| 合計ジャッジ時間 | 965 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 WA * 5 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%d", &n);
| ^~~~~~~~~~~~~~~
main.c:11:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d", &w[i]);
| ^~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(void) {
int i, j;
int n, w[101];
int total = 0;
int memo[10001] = {0};
scanf("%d", &n);
for(i = 0;i < n;i++){
scanf("%d", &w[i]);
total += w[i];
}
for(j = 0;j < 100;j++){
memo[w[j]] = 1;
for(i = 0;i < 10000;i++){
if(memo[i] == 1 && i + w[j] <= 10000){
memo[i + w[j]] = 1;
}
}
}
if(memo[total / 2] == 1){
printf("possible\n");
}
else{
printf("impossible\n");
}
return 0;
}
suppy193