Codeforces #61 (div2) A "Petya and Java "

問題:http://codeforces.com/contest/66/problem/A

与えられた数値がJavaの数値型であるbyte,short,int,long,BigIntegerのどの範囲に入るかを求める.

そのまま.

コード

import java.util.*;
import java.math.*;
import static java.math.BigInteger.*;

public class A_PetyaAndJava {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		BigInteger i = s.nextBigInteger();
		String r = "BigInteger";
		if (i.compareTo(valueOf(Byte.MAX_VALUE)) <= 0) {
			r = "byte";
		} else if (i.compareTo(valueOf(Short.MAX_VALUE)) <= 0) {
			r = "short";
		} else if (i.compareTo(valueOf(Integer.MAX_VALUE)) <= 0) {
			r = "int";
		} else if (i.compareTo(valueOf(Long.MAX_VALUE)) <= 0) {
			r = "long";
		}
		System.out.println(r);
	}
}