Submission #1452636


Source Code Expand

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

import static java.lang.Integer.parseInt;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		int N = parseInt(br.readLine());

		int[] dp = new int[10001];
		dp[0] = 1;

		StringTokenizer st = new StringTokenizer(br.readLine());

		for (int i = 0; i < N; i++) {

			int p = parseInt(st.nextToken());

			for (int j = 10000; j >= p; j--) {
				dp[j] += dp[j - p];
			}
		}

		int ans = 0;

		for (int i = 0; i <= 10000; i++) {
			if (dp[i] != 0) ans++;
		}

		System.out.println(ans);
	}
}

Submission Info

Submission Time
Task A - コンテスト
User sawfish
Language Java8 (OpenJDK 1.8.0)
Score 2
Code Size 798 Byte
Status AC
Exec Time 85 ms
Memory 21588 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 70 ms 18260 KB
01 AC 76 ms 21588 KB
02 AC 85 ms 18772 KB
90 AC 67 ms 19156 KB
91 AC 74 ms 20820 KB