Submission #1439483
Source Code Expand
#include<stdio.h> int N; int p[101]; int dp[10001]={0}; void DP() { dp[0] = 1; int j,i; for(j=1;j<=N;j++) for(i=10000;i>=0;i--) if(dp[i] == 1) dp[p[j]+i] = 1; } int main() { int i,j,result=0; scanf("%d",&N); for(i=1;i<=N;i++) scanf("%d",&p[i]); DP(); for(i=0;i<=10000;i++) result += dp[i]; printf("%d\n",result); }
Submission Info
Submission Time | |
---|---|
Task | A - コンテスト |
User | makss |
Language | C++14 (GCC 5.4.1) |
Score | 2 |
Code Size | 391 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 128 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:20:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&N); ^ ./Main.cpp:22:22: 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 | 1 ms | 128 KB |
90 | AC | 1 ms | 128 KB |
91 | AC | 1 ms | 128 KB |