Submission #3146247


Source Code Expand

#include<cstdio>
#include<algorithm>

using namespace std;

int main(){
	int n; scanf("%d", &n);
	bool dp[10001] = {};
	dp[0] = 1;
	for(int i = 0; i < n; i++){
		int p; scanf("%d", &p);
		for(int j = 10000; j >= p; j--) dp[j] |= dp[j - p];
	}
	printf("%d\n", count(dp, dp + 10000, 1));
	return 0;
}

Submission Info

Submission Time
Task A - コンテスト
User orpheus
Language C++14 (GCC 5.4.1)
Score 2
Code Size 313 Byte
Status AC
Exec Time 1 ms
Memory 128 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:14:41: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::iterator_traits<bool*>::difference_type {aka long int}’ [-Wformat=]
  printf("%d\n", count(dp, dp + 10000, 1));
                                         ^
./Main.cpp:7:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  int n; scanf("%d", &n);
                        ^
./Main.cpp:11:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   int p; scanf("%d", &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 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