Submission #1510777
Source Code Expand
#include<cstdio> int dp[20000]; int main(void) { int n; scanf("%d",&n); int p[200]; for(int i=0; i<n; i++) scanf("%d", &p[i]); dp[0] = 1; for(int i=0; i<n; i++) for(int j=15000; j>=0; j--) if(dp[j]) dp[j+p[i]] = 1; int res=0; for(int j=0; j<15000; j++) if(dp[j]) res++; printf("%d\n", res); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - コンテスト |
User | cookies |
Language | C++14 (GCC 5.4.1) |
Score | 2 |
Code Size | 439 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 128 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:7:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ^ ./Main.cpp:11:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &p[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 | 128 KB |
01 | AC | 1 ms | 128 KB |
02 | AC | 2 ms | 128 KB |
90 | AC | 1 ms | 128 KB |
91 | AC | 1 ms | 128 KB |