結果
問題 | No.4 おもりと天秤 |
ユーザー |
|
提出日時 | 2017-09-18 23:53:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 5,000 ms |
コード長 | 289 bytes |
コンパイル時間 | 532 ms |
コンパイル使用メモリ | 65,004 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 10:22:42 |
合計ジャッジ時間 | 1,404 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 5 | main() | ^~~~
ソースコード
#include<iostream> using namespace std; bool dp[101][20001]; int n,w; main() { dp[0][10000]=1; cin>>n; for(int i=0;i<n;i++) { cin>>w; for(int j=0;j<=20000;j++) { if(dp[i][j]) { dp[i+1][j-w]=dp[i+1][j+w]=1; } } } cout<<(dp[n][10000]?"":"im")<<"possible"<<endl; }