Submission #6408076


Source Code Expand

#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
bool dp[101][10001];
int p[100];
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> p[i];
	dp[0][0] = 1;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= i * 100; j++) {
			dp[i + 1][j] |= dp[i][j];
			dp[i + 1][j + p[i]] |= dp[i][j];
		}
	}
	int ans = 0;
	for (int i = 0; i <= N * 100; i++) if (dp[N][i]) ans++;
	cout << ans << endl;
}

Submission Info

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

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 256 KB
01 AC 1 ms 512 KB
02 AC 2 ms 1024 KB
90 AC 1 ms 256 KB
91 AC 1 ms 256 KB