Submission #1307776


Source Code Expand

#include<stdio.h>
#include<stdbool.h>

int main(){
	int N,i,j=1,cnt,p,dp[10001];
	_Bool checked[10001]={false};
	scanf("%d",&N);
	while(N--){
		scanf("%d\n",&p);
		i=cnt=j;
		while(i--){
			if(!checked[dp[i]+p]){
				++cnt;
				checked[dp[i]+p]=true;
				dp[j++]=dp[i]+p;
			}
		}
	}
	printf("%d\n",cnt);	
}

Submission Info

Submission Time
Task A - コンテスト
User hanada3355
Language C (GCC 5.4.1)
Score 2
Code Size 328 Byte
Status AC
Exec Time 2 ms
Memory 384 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:7:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&N);
  ^
./Main.c:9:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d\n",&p);
   ^

Judge Result

Set Name All
Score / Max Score 2 / 2
Status
AC × 5
Set Name Test Cases
All 00, 01, 02, 90, 91
Case Name Status Exec Time Memory
00 AC 2 ms 384 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