Submission #1443956
Source Code Expand
#include <bits/stdc++.h> #define REP(i,n) for(int i=0;i<(int)(n);i++) #define ALL(x) (x).begin(),(x).end() #define LL long long using namespace std; int main(){ int N; cin>>N; int p[N]; REP(i,N)cin>>p[i]; bool dp[10001]; fill_n(dp,10001,false); dp[0]=true; REP(i,N){ for (int j=10000;j>=0;j--){ if(dp[j]) dp[j+p[i]]=true; } } int ans=0; REP(i,10001){ if(dp[i])ans++; } cout<<ans<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - コンテスト |
User | inmir |
Language | C++14 (GCC 5.4.1) |
Score | 2 |
Code Size | 544 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 256 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 2 / 2 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | 00, 01, 02, 90, 91 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00 | AC | 1 ms | 256 KB |
01 | AC | 1 ms | 256 KB |
02 | AC | 2 ms | 256 KB |
90 | AC | 1 ms | 256 KB |
91 | AC | 1 ms | 256 KB |