Submission #2327013
Source Code Expand
#include<stdio.h> #include<stdlib.h> #include<math.h> typedef long long int int64; #define MAX(a,b) ((a)>(b)?(a):(b)) #define MIN(a,b) ((a)<(b)?(a):(b)) #define ABS(a) ((a)>(0)?(a):-(a)) void run(void){ int n; scanf("%d",&n); int *array=(int *)calloc(100*100+1,sizeof(int)); array[0]=1; int sum=0; int i; for(i=0;i<n;i++){ int p; scanf("%d",&p); int j; for(j=sum;j>=0;j--){ if(array[j]) array[j+p]=1; } sum+=p; } int cnt=0; for(i=0;i<=sum;i++){ if(array[i]) cnt++; } printf("%d\n",cnt); 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 | 638 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Compile Error
./Main.c: In function ‘run’: ./Main.c:13:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ^ ./Main.c:20: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 | 256 KB |
01 | AC | 1 ms | 256 KB |
02 | AC | 1 ms | 256 KB |
90 | AC | 1 ms | 256 KB |
91 | AC | 1 ms | 256 KB |