Submission #97411


Source Code Expand

#include <stdio.h>
#include <iostream>
using namespace std;

bool d[10010];
bool pd[10010];

int main(){
	int N;
	int p[110];
	pd[0] = true;
	d[0] = true;

	scanf("%d", &N);
	for(int i=0; i<N; i++)
		scanf("%d", &p[i]);

	for(int i=0; i<N; i++){
		for(int j=0; j<10010; j++){
			if(pd[j]){
				d[j+p[i]] = true;
			}
		}
		for(int j=0; j<10010; j++){
			pd[j] = d[j];
		}
	}

	int ans = 0;
	for(int i=0; i<10010; i++){
		if(d[i]){
			ans ++;
		}
	}
	cout << ans << endl;
}

Submission Info

Submission Time
Task A - コンテスト
User aki33524
Language C++ (G++ 4.6.4)
Score 2
Code Size 507 Byte
Status AC
Exec Time 22 ms
Memory 780 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:14:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:16:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]

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 21 ms 776 KB
01 AC 21 ms 780 KB
02 AC 22 ms 780 KB
90 AC 21 ms 776 KB
91 AC 20 ms 776 KB