Submission #19672416


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define MOD int(1e9+7)
#define INF int(1e9+7)
#define LINF ll(1e18+7)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define P pair<ll,ll>
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

int n;
int p[110];
bool dp[11000];

int main(){
  cin>>n;
  rep(i,n) cin>>p[i];
  dp[0]=1;
  rep(i,n){
    for(int sum=10000; sum>=0; sum--){
      if(sum-p[i]<0) continue;
      if(dp[sum-p[i]]) dp[sum]=1;
    }
  }
  int ans=0;
  for(int sum=0; sum<=10000; sum++){
    if(dp[sum]) ans++;
  }
  cout<<ans<<endl;
}

Submission Info

Submission Time
Task A - コンテスト
User uytvcc
Language C++ (GCC 9.2.1)
Score 2
Code Size 626 Byte
Status AC
Exec Time 11 ms
Memory 3572 KB

Judge Result

Set Name All
Score / Max Score 2 / 2
Status
AC × 5
Set Name Test Cases
All 00, 01, 02, 90, 91
Case Name Status Exec Time Memory
00 AC 9 ms 3416 KB
01 AC 4 ms 3572 KB
02 AC 11 ms 3420 KB
90 AC 6 ms 3532 KB
91 AC 3 ms 3568 KB