Submission #1319799
Source Code Expand
#include<stdio.h> int N; int dp[10001] = {0}; int main(void){ dp[0] = 1; scanf("%d",&N); int i,j; for (i=0;i<N;i++){ int p; scanf("%d",&p); for (j=10000;j>=p;j--){ if (dp[j-p]){ dp[j] = 1; } } } int ans = 0; for (i=0;i<10001;i++){ if (dp[i]){ ans++; } } printf("%d\n",ans); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - コンテスト |
User | niyarin |
Language | C (GCC 5.4.1) |
Score | 2 |
Code Size | 461 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 128 KB |
Compile Error
./Main.c: In function ‘main’: ./Main.c:8:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&N); ^ ./Main.c:12:9: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&p); ^
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 |