Submission #1243966
Source Code Expand
#include <bits/stdc++.h> #define ll long long #define INF 1000000005 #define MOD 1000000007 #define EPS 1e-10 #define rep(i,n) for(int i=0;i<n;++i) using namespace std; typedef pair<int,int>P; const int MAX_N = 105; const int MAX_S = 10005; int a[MAX_N]; int dp[MAX_S]; int n; int main() { scanf("%d",&n); dp[0] = 1; rep(i,n){ scanf("%d",&a[i]); for(int j=10000;j>=0;j--){ if(dp[j]){ dp[j+a[i]] = 1; } } } int ans = 0; rep(i,10001){ if(dp[i]){ ans++; } } printf("%d\n",ans); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - コンテスト |
User | kopricky |
Language | C++14 (GCC 5.4.1) |
Score | 2 |
Code Size | 561 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 256 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:21:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ^ ./Main.cpp:24:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&a[i]); ^
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 | 2 ms | 256 KB |
90 | AC | 1 ms | 256 KB |
91 | AC | 1 ms | 256 KB |