結果
| 問題 | No.4 おもりと天秤 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2016-04-06 11:46:10 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 447 bytes | 
| コンパイル時間 | 595 ms | 
| コンパイル使用メモリ | 60,248 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-10-04 02:13:36 | 
| 合計ジャッジ時間 | 1,313 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 WA * 4 | 
ソースコード
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int n;
int w[110];
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>w[i];
    }
    int ans1=0,ans2=0;
    sort(w,w+n);
    for(int i=n-1;i>=0;i--){
        if(ans1>ans2){
            ans2+=w[i];
        }
        else ans1+=w[i];
    }
    //cout<<ans1<<" "<<ans2<<endl;
    if(ans2==ans1)cout<<"possible"<<endl;
    else cout<<"impossible"<<endl;
}
            
            
            
        