Petya and Java

Codeforces Beta Round #86 (Div. 2 Only) B PFAST Inc. B. PFAST Inc. time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output When little Petya grew up and entered the uni 阅读详情

Description

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:

1) byte occupies 1 byte and allows you to store numbers from  - 128 to 127

2) short occupies 2 bytes and allows you to store numbers from  - 32768 to 32767

3) int occupies 4 bytes and allows you to store numbers from  - 2147483648 to 2147483647

4) long occupies 8 bytes and allows you to store numbers from  - 9223372036854775808 to 9223372036854775807

5) 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.

Input

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 ncan'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).

Output

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.

Sample Input

Input
127
Output
byte
Input
130
Output
short
Input
123456789101112131415161718192021222324
Output
BigInteger
题意:
输入一个数字,判断其所属的类型。此题用字符串比较较为简单,用strcmp函数比较字符串大小。
代码如下:
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
	char a[101];
    scanf("%s",a); 
	int l=strlen(a);
	if(l<3||(l==3&&strcmp(a,"127")<=0))
	{
		printf("byte\n");
	}
	else if(l<5||(l==5&&strcmp(a,"32767")<=0))
	{
		printf("short\n");
	}
	else if(l<10||l==10&&strcmp(a,"2147483647")<=0)
	{
		printf("int\n");
	}
	else if(l<19||(l==19&&strcmp(a,"9223372036854775807")<=0))
	{
		printf("long\n");
	}
	else 
	printf("BigInteger\n");
 } 



帕塞瓦尔定理(Parseval‘s theorem)的证明 帕塞瓦尔定理(Parseval's theorem)表明了信号在时域和频域上的能量相等。 阅读详情

相关推荐

抖音直播行为规范考试

抖音直播行为规范考试

Q1642968641的博客 1万+

A. Petya and Java

time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Petya has recently started attending a programming club.

无知的我 1955

手把手教你用scATAC-seq分析拟南芥根尖染色质可及性(附代码实战)

本文详细介绍了使用scATAC-seq技术分析拟南芥根尖染色质可及性的完整流程,涵盖从实验设计、数据质控、细胞分群到差异分析和多组学整合的实战步骤。通过具体的代码示例,帮助植物研究者掌握单细胞表观组学分析的核心方法,揭示细胞异质性和基因调控动态。

weixin_29291185的博客 275

【CodeForces】[66A]Petya and Java

判断一个数的数据类型除了BigInteger之外其它的都可以直接判断 所以主要是判断是否是BigInteger 可根据位数 那么只需要判断位数与边界值位数相同的情况 其余的就是一些小技巧了

BoilTask Talk Show 695

ansys命令流力磁耦合仿真

文章目录前言一、力磁耦合仿真流程二、静力学仿真三、力磁耦合模型构建四、静磁学仿真总结 前言 一、力磁耦合仿真流程 力磁耦合有限元仿真流程中,首先进行静力学仿真,经过前处理模块、分析计算模块和后处理模块提取三维模型单元应力,然后根据力磁耦合方程中,通过matlab将单元应力导入到磁导率与应力的关系式中,得到单元的相对磁导率。最后采用载荷传递耦合方式,进行静磁学模拟仿真,分析计算得到该载荷下试件的磁场分布。,如下图所示为力磁耦合仿真流程图: 二、静力学仿真 下图为中心预制条形缺陷的Q235钢板试..

wsfwsf128的博客 2668

【通信原理 入坑之路】—— 详解IQ调制以及星座图原理

文章目录一. IQ调制与解调的原理与过程二.PSK(相移键控)和IQ调制的关系:2.1 用IQ调制实现QPSK调制 一. IQ调制与解调的原理与过程 IQ调制的定义是:“IQ调制就是数据分为两路,分别进行载波调制,两路载波相互正交。I是in-phase(同相), q是 quadrature(正交)” 我们通过下面的示意图介绍IQ调制的过程: 首先,信号分成两路:I路和Q路(为了方便理解我们把这两...

凝望,划过星空的博客 11万+

CodeForce 66A Petya and Java

A - Petya and Java Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Description Little Petya has recently started attending a programming clu

Calm微笑 580

[RK3568 Android11] 开发之默认授予系统预置的APP权限

目录 一、系统预置的APP权限 二、默认授予系统预置的APP权限 一、系统预置的APP权限 1、在打开系统预置的APP时,都会弹窗提示,并且需要人工确定授予权限; 2、有些客户对定制有需求,需要系统预置的APP自动默认授予权限; 二、默认授予系统预置的APP权限 注意此方法只对系统预置的APP起效果,后期手动安装的APP无效; 修改文件: frameworks/base/services/core/java/com/android/server/pm/per...

~未来可期~ 5061

CodeForces 66A - Petya and Java(思维)

A. Petya and Java time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Little Petya has recently started attending a programming club. Naturall

Snakeflute的博客 575

2020.12.25丨CRISPResso2安装教程

一个月前接到一个项目,说是做关于CRISPR的编辑效率个性化分析。本来这个分析以前是没有做过的,不过客户发了参考文献。里面流程和命令行都非常清楚,再加上读研期间CRISPR的项目“中道崩殂”,让我对CRiSPR的技术有些执念,便下决心接下来试试。 整个测序分析使用的工具就是CRISPResso,,下面介绍最快捷的安装方式。 首先,CRISPResso只支持python2.X,不支持3.X你需要下载Anaconda或者miniconda,以Miniconda为例: 安装环境: Linux 64-bi

4639

37、基于铁电场效应晶体管(FeFET)的片上深度神经网络(DNN)直接反馈对齐训练

本文提出了一种基于铁电场效应晶体管(FeFET)的深度神经网络(DNN)训练加速器架构,结合直接反馈对齐(DFA)算法和FeFET的独特物理特性,以解决当前DNN训练中反向传播(BP)算法带来的高计算开销、复杂数据依赖和高能耗问题。通过设计基于FeFET的MVM引擎、低功耗ADC和随机数生成器(RNG),该架构在速度和功率效率方面相比现有基于ReRAM的加速器分别提升了1.3倍和2.5倍。研究为未来高效能AI训练硬件的发展提供了新的思路和实现路径。

wine的专栏 168

Petya and Java strcmp的使用

Petya and Java Time Limit: 2000MS Memory Limit: 262144K 64bit IO Format: %I64d & %I64u Description Little Petya has recently started attending a programming club. Naturally he is facing

wwk0125的专栏 569

华为HCIP的学习大纲和计划

HCIP(华为认证 ICT 高级工程师)核心围绕华为 ICT 技术体系,不同方向(如路由交换、云计算、安全等)课程目录不同,以下是最热门的。

迷逝 589

Petya and Java strcmp的使用

B - Petya and Java Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Description Little Petya has recently started attending a programming club. Na

qq_34472846的博客 649

vb 6.0并口开发操作实例

vb6并口开发,简体中文,试例内有inpout32.dll动态链接库

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

Petya and Java(整型类型)

Petya and Java Time Limit:2000MS    Memory Limit:262144KB     64bit IO Format:%I64d& %I64u Submit Status Description Little Petya has recently started attending a programming club. Naturally

昨日明眸 599

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

CodeForces Petya and Java strcmp的使用

B - Petya and JavaTime Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u DescriptionLittle Petya has recently started attending a programming club. Naturally he is facing t...

weixin_30470857的博客 67

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

Codeforces 66A Petya and Java

Petya and Java 题意:五种数据类型,每种类型能存储的数据范围不同,占据的字节数也不同,求存储n可用的最少字节的数据类型。 思路:以字符串形式表示n,用函数strcmp进行比较。 #include #include #include using namespace std; int main(){ char a[105]; int len; scanf("%s",a);

渣渣眼里没有水题 465

Java语言strcmp函数用法_Petya and Java strcmp的使用

Little Petya has recently started attending a programming club.Naturally he is facing the problem of choosing a programminglanguage. After long considerations he realized that Java is thebest choice. ...

weixin_39638305的博客 270

CodeForces 66A Petya and Java

A. Petya and Java time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Petya has recently started attendi

A_ice 593

codeforces | java | 112A | Petya and Strings

【代码】codeforces | java | 112A | Petya and Strings。

iCling的博客 213

【水String】#61 A. Petya and Java

A. Petya and Java time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Petya has recently started attendi

CD's Coding 823

【Codeforces】66A - Petya and Java(模拟)

time limit per test  2 seconds memory limit per test  256 megabytes input  standard input output  standard output Little Petya has recently started attending a programming cl

wyg1997 924

(判断数字类型)C - Petya and Java CodeForces - 66A

C - Petya and Java CodeForces - 66A Little Petya has recently started attending a programming club. Naturally he is facing the problem of choosing a programming language. After long considerations he ...

tomjobs的博客 518

Codeforces 66A:Petya and Java(水题)

A. Petya and Java time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Petya has recently started attendi

zugofn的博客 441

CF 112A.Petya and Strings(Java实现)

首先获取两个输入值,由于不区分大小写,就把两个值全变为小写,再按位比较,一旦出现大于或者小于的情况,结果就固定。这个问题有多个关键点,长度范围(1-100),字母大小写无关紧要,三种输出结果,按字典序列比较。见解,希望能得到您的指点和点悟;如果您是和我一样的同学,也希望这篇文章能对您有所帮助。

Dr_Si的博客 276

【codeforces】- Petya and Java(给不同的数,判断大小,选择不同数据类型)

A. Petya and Java time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Petya has recently started attendi

Bear1998的博客 653
上一篇: Petya and Countryside
下一篇: Toy Army
Never_Say-Never
博客等级 码龄11年 9粉丝 181原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值