CF66A.Petya and Java
普及-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Little Petya has recently started attending a programming club. Naturally he is facing the problem of choosing a programming language. After long considerations he realized that Java is the best choice. The main argument in favor of choosing Java was that it has a very large integer data type, called BigInteger.
But having attended several classes of the club, Petya realized that not all tasks require using the BigInteger type. It turned out that in some tasks it is much easier to use small data types. That's why a question arises: "Which integer type to use if one wants to store a positive integer n?"
Petya knows only 5 integer types:
-
byte occupies 1 byte and allows you to store numbers from - 128 to 127
-
short occupies 2 bytes and allows you to store numbers from - 32768 to 32767
-
int occupies 4 bytes and allows you to store numbers from - 2147483648 to 2147483647
-
long occupies 8 bytes and allows you to store numbers from - 9223372036854775808 to 9223372036854775807
-
BigInteger can store any integer number, but at that it is not a primitive type, and operations with it are much slower.
For all the types given above the boundary values are included in the value range.
From this list, Petya wants to choose the smallest type that can store a positive integer n. Since BigInteger works much slower, Peter regards it last. Help him.
小佩特亚最近开始参加一个编程俱乐部。很自然地,他面临着选择编程语言的问题。经过长时间的思考,他意识到 Java 是最佳选择。支持选择 Java 的主要理由是它拥有一个非常大的整数数据类型,名为 BigInteger。
但在参加了编程俱乐部的几节课后,佩特亚意识到并非所有任务都需要使用 BigInteger 类型。事实证明,在某些任务中,使用较小的数据类型要简单得多。因此便产生了一个问题:“如果想存储一个正整数 n,应选用哪种整数类型?”
佩特亚只知道以下 5 种整数类型:
byte占用 1 字节,可存储范围为 −128 到 127 的整数;short占用 2 字节,可存储范围为 −32768 到 32767 的整数;int占用 4 字节,可存储范围为 −2147483648 到 2147483647 的整数;long占用 8 字节,可存储范围为 −9223372036854775808 到 9223372036854775807 的整数;BigInteger可以存储任意大小的整数,但它不是基本类型,且对其执行的操作要慢得多。
上述所有类型的边界值均包含在其取值范围内。
佩特亚希望从该列表中选出能存储正整数 n 的最小类型。由于 BigInteger 运行速度慢得多,佩特亚将其视为最后的选择。请帮助他完成这一选择。
输入格式
The first line contains a positive number n. It consists of no more than 100 digits and doesn't contain any leading zeros. The number n can't be represented as an empty string.
Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d).
第一行包含一个正整数 n。该数最多有 100 位数字,且不包含前导零。数字 n 不能表示为空字符串。
请注意:在 C++ 中,不要使用 %lld 格式说明符来读取或写入 64 位整数。推荐使用 cout(您也可以使用 %I64d)。
输出格式
Print the first type from the list "byte, short, int, long, BigInteger", that can store the natural number n, in accordance with the data given above.
从列表 “byte、short、int、long、BigInteger” 中输出第一个能够存储自然数 n 的类型,具体依据上述所给数据。
输入输出样例
输入#1
127
输出#1
byte
输入#2
130
输出#2
short
输入#3
123456789101112131415161718192021222324
输出#3
BigInteger
输入解题思路,AI测评打分。不知道怎么写?