結果

問題 No.505 カードの数式2
ユーザー sawa_tsuka
提出日時 2017-04-21 22:35:35
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 404 bytes
コンパイル時間 461 ms
コンパイル使用メモリ 53,236 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-20 05:28:00
合計ジャッジ時間 1,351 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main(void){
    int n,t,d;
    cin>>n>>t;
    for(;--n;){
        cin>>d;
        if(d<0){
            t-=d;
        }else if(d==0){
            if(t<0){
                t=0;
            }
        }else if(d==1){
            t+=d;
        }else{
            if(t<=1){
                t+=d;
            }else t*=d;
        }
    }
    cout<<t;
    return 0;
}
0