結果

問題 No.4 おもりと天秤
ユーザー albicilla
提出日時 2016-04-06 11:42:53
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 407 bytes
コンパイル時間 496 ms
コンパイル使用メモリ 55,088 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-04 02:09:48
合計ジャッジ時間 1,327 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>

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;

    for(int i=0;i<n;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;
}
0