Submission #4206


Source Code Expand

import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.util.Arrays.fill;

import java.io.*;
import java.math.BigInteger;
import java.util.StringTokenizer;

public class A {
	
	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;
	
	static void solve() throws Exception {
		int N = nextInt();
		int [] choice = new int[4];
		String line = next();
		for(int i = 0;i< N;i++)
		{
			int n = Integer.parseInt(line.substring(i,i+1));
			choice[n - 1]++;
			
		}
		
		int min = Integer.MAX_VALUE;
		int max = Integer.MIN_VALUE;
		for(int i = 0;i< 4;i++)
		{
			min = Math.min(min, choice[i]);
			max = Math.max(max,choice[i]);
		}
		out.print(max + " " + min);
	}
	
	public static void main(String[] args) throws Exception {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		solve();
		in.close();
		out.close();
	}
	
	static String next() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}
	
	static char nextChar() throws IOException {
		String token = next();
		if (token.length() != 1) {
			throw new IllegalArgumentException("String \"" + token + "\" is not a single character");
		}
		return token.charAt(0);
	}
	
	static int nextInt() throws IOException {
		return parseInt(next());
	}
	
	static long nextLong() throws IOException {
		return parseLong(next());
	}
	
	static BigInteger nextBigInt() throws IOException {
		return new BigInteger(next());
	}
}

Submission Info

Submission Time
Task A - センター採点
User JooK
Language Java (OpenJDK 1.7.0)
Score 0
Code Size 1758 Byte
Status CE

Compile Error

Main.java:11: class A is public, should be declared in a file named A.java
public class A {
       ^
1 error