Submission #5630287


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

int main(){
    int n;
    cin>>n;
    int p[n];
    rep(i,n) cin>>p[i];
    bool dp[10010];
    rep(i,10010)dp[i]=false;
    dp[0]=true;
    rep(i,n){
        for(int j=10009;j>=p[i];--j){
            if(dp[j-p[i])dp[j]=true;
        }
    }
    int ans=0;
    rep(i,10010)if(dp[i])++ans;
    cout<<ans<<endl;
}

Submission Info

Submission Time
Task A - コンテスト
User db7
Language C++14 (GCC 5.4.1)
Score 0
Code Size 803 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:23:25: error: expected ‘]’ before ‘)’ token
             if(dp[j-p[i])dp[j]=true;
                         ^