Submission #97495


Source Code Expand

Copy
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class A {

	int INF = 1 << 28;
	//long INF = 1L << 62;
	double EPS = 1e-10;

	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), sum = 0;
		int[] ar = new int[n];
		for(int i=0;i<n;i++) { ar[i] = sc.nextInt(); sum += ar[i]; }
		boolean[] dp = new boolean[sum + 1]; dp[0] = true;
		
		for(int j=0;j<n;j++) for(int i=sum-ar[j];i>=0;i--) dp[i+ar[j]] |= dp[i];
		int cnt = 0;
		for(int i=0;i<=sum;i++) if(dp[i]) cnt++;
		
		System.out.println(cnt);
		
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Submission Info

Submission Time
Task A - コンテスト
User nyama
Language Java (OpenJDK 1.7.0)
Score 0
Code Size 809 Byte
Status CE

Compile Error

Main.java:8: class A is public, should be declared in a file named A.java
public class A {
       ^
Main.java:34: cannot access Main
bad class file: RegularFileObject[Main.java]
file does not contain class Main
Please remove or make sure it appears in the correct subdirectory of the classpath.
		new Main().run();
		    ^
2 errors