Submission #4145991
Source Code Expand
#include<stdio.h> #include<stdlib.h> void run(void){ int n; scanf("%d",&n); int *dp=(int *)calloc(100*n+1,sizeof(int)); dp[0]=1; for(int i=0;i<n;i++){ int p; scanf("%d",&p); for(int j=100*n;j>=p;j--){ dp[j]|=dp[j-p]; } } int ans=0; for(int i=0;i<=100*n;i++) ans+=dp[i]; printf("%d\n",ans); return; } int main(void){ run(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - コンテスト |
User | sansen |
Language | C (GCC 5.4.1) |
Score | 2 |
Code Size | 408 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Compile Error
./Main.c: In function ‘run’: ./Main.c:6:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ^ ./Main.c:11:5: 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 | 256 KB |
90 | AC | 1 ms | 128 KB |
91 | AC | 1 ms | 128 KB |