Submission #97376
Source Code Expand
#include <cstdio> #include <iostream> #include <numeric> #include <vector> using namespace std; #define For(i,x) for (int i=0; i<(int)(x); i++) typedef vector<int> vi; int calc(vi& v) { const int n = v.size() * 100; vi dp(n + 1); dp[0] = 1; For(i, v.size()) { for (int j = n; j >= 0; j--) { if (dp[j] > 0 && j + v[i] <= n) { dp[j + v[i]] = 1; } } } return accumulate(dp.begin(), dp.end(), 0); } int main() { int n; scanf("%d", &n); vi v(n); For(i, n) scanf("%d", &v[i]); printf("%d\n", calc(v)); }
Submission Info
Submission Time | |
---|---|
Task | A - コンテスト |
User | noriok |
Language | C++ (G++ 4.6.4) |
Score | 2 |
Code Size | 641 Byte |
Status | AC |
Exec Time | 23 ms |
Memory | 776 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:29:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] ./Main.cpp:32:33: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
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 | 21 ms | 732 KB |
01 | AC | 21 ms | 768 KB |
02 | AC | 23 ms | 776 KB |
90 | AC | 18 ms | 776 KB |
91 | AC | 18 ms | 776 KB |