Submission #6327815
Source Code Expand
#include <bits/stdc++.h> using namespace std; using ll=long long; const int mod =1e9+7; int dp[10010]; int main(){ int n; cin>>n; vector<int> a(n); for(int i=0;i<n;i++)cin>>a.at(i); memset(dp,0,sizeof(dp)); dp[0]=1; for(int i=0;i<n;i++){ for(int j=10000;j>=0;j--){ if(j>=a.at(i)&&dp[j-a.at(i)]==1)dp[j]=1; } } int ans=0; for(int j=0;j<=10000;j++){ ans+=dp[j]; } cout<<ans<<endl; }
Submission Info
Submission Time | |
---|---|
Task | A - コンテスト |
User | suzuken_w |
Language | C++14 (GCC 5.4.1) |
Score | 2 |
Code Size | 485 Byte |
Status | AC |
Exec Time | 3 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 | 2 ms | 256 KB |
02 | AC | 3 ms | 256 KB |
90 | AC | 1 ms | 256 KB |
91 | AC | 1 ms | 256 KB |