题目描述:

              Integer in C++

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 128000/64000 KB (Java/Others)

Problem Description

  KIDx: I like Java much more than C++, because I can use BigInteger in Java. :)

However, KIDx has to use C++ language to do a project...

Little KIDx knows 3 integer types in C++:

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

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

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

For all the types given above the boundary values are included in the value range. From this list, KIDx wants you to choose the smallest type that can store a positive integer n.

Input

  Each case contains a positive integer n. It consists of at least one digit and at most 30 digits. In addition, it doesn't contain any leading zeros.

Output

  For each line, print the first type from the list "short, int, long long", that can store the natural number n. If no one can store the number, just print "It is too big!".

Sample Input

102
50000
123456789101112131415161718192021222324

Sample Output

short
int
It is too big! 简单字符串处理,留作纪念!!!
竟然忘记了strcmp这个函数的强大功能,它的比较是按ASCII码表的。
 #include <iostream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std; const int maxn = + ;
char s[maxn], t[maxn]; int main()
{
int i, len;
while (gets(s))
{
len = strlen(s);
if (s[] == '-')
{
int l = ;
for (i = ; i < len; i++)
t[l++] = s[i];
if ((strcmp(t, "") <= && l == strlen("")) || l < strlen(""))
puts("short");
else if ((strcmp(t, "") <= && l == strlen("")) || l < strlen(""))
puts("int");
else if ((strcmp(t, "") <= && l == strlen("")) || l < strlen("") )
puts("long long");
else
puts("It is too big!");
}
else
{
if ((strcmp(s, "") <= && len == strlen("")) || len < strlen(""))
puts("short");
else if ((strcmp(s, "") <= && len == strlen("")) || len < strlen(""))
puts("int");
else if ((strcmp(s, "") <= && len == strlen("")) || len < strlen(""))
puts("long long");
else
puts("It is too big!");
}
}
return ;
}

2013 gzhu 校赛的更多相关文章

  1. SCNU省选校赛第二场B题题解

    今晚的校赛又告一段落啦,终于"开斋"了! AC了两题,还算是满意的,英语还是硬伤. 来看题目吧! B. Array time limit per test 2 seconds me ...

  2. 2016 华南师大ACM校赛 SCNUCPC 非官方题解

    我要举报本次校赛出题人的消极出题!!! 官方题解请戳:http://3.scnuacm2015.sinaapp.com/?p=89(其实就是一堆代码没有题解) A. 树链剖分数据结构板题 题目大意:我 ...

  3. 2014上半年acm总结(1)(入门+校赛)

    大一下学期才开始了acm,不得不说有一点迟,但是acm确实使我的生活充实了很多,,不至于像以前一样经常没事干=  = 上学期的颓废使我的c语言学的渣的一笔..靠考前突击才基本掌握了语法 寒假突然醒悟, ...

  4. 2017CUIT校赛-线上赛

    2017Pwnhub杯-CUIT校赛 这是CUIT第十三届校赛啦,也是我参加的第一次校赛. 在被虐到崩溃的过程中也学到了一些东西. 这次比赛是从5.27早上十点打到5.28晚上十点,共36小时,中间睡 ...

  5. 2013年山东省赛F题 Mountain Subsequences

    2013年山东省赛F题 Mountain Subsequences先说n^2做法,从第1个,(假设当前是第i个)到第i-1个位置上哪些比第i位的小,那也就意味着a[i]可以接在它后面,f1[i]表示从 ...

  6. [蓝桥杯]2013蓝桥省赛B组题目及详解

    /*——————————————————————————————————————————————————————————— 题目:2013 高斯日记T-1 问题描述: 大数学家高斯有一个好习惯:无论如 ...

  7. 2013年省赛H题

    2013年省赛H题你不能每次都快速幂算A^x,优化就是预处理,把10^9预处理成10^5和10^4.想法真的是非常巧妙啊N=100000构造两个数组,f1[N],间隔为Af2[1e4]间隔为A^N,中 ...

  8. 2013年省赛I题 Thrall’s Dream

    2013年省赛I题判断单向联通,用bfs剪枝:从小到大跑,如果遇到之前跑过的点(也就是编号小于当前点的点),就o(n)传递关系. bfs #include<iostream> #inclu ...

  9. HZNU第十二届校赛赛后补题

    愉快的校赛翻皮水! 题解 A 温暖的签到,注意用gets #include <map> #include <set> #include <ctime> #inclu ...

随机推荐

  1. Java随机数技巧-新手篇

    package 向家康; import java.util.concurrent.ThreadLocalRandom; public class 练习21 { public static void m ...

  2. asyncTask 的execute和executeOnExecutor 方法

    asyncTask.execute Android.os.Build.VERSION_CODES.DONUT, this was changed to a pool of threads allowi ...

  3. Android获取窗口可视区域大小: getWindowVisibleDisplayFrame()

    getWindowVisibleDisplayFrame()方法 getWindowVisibleDisplayFrame()是View类下的一个方法,从方法的名字就可以看出,它是用来获取当前窗口可视 ...

  4. pandas常见函数详细使用

    groupby函数 pandas提供了一个灵活高效的groupby功能,它使你能以一种自然的方式对数据集进行切片.切块.摘要等操作,根据一个或多个键(可以是函数.数组.Series或DataFrame ...

  5. ubuntu 14.04 LTS 安装webbentch压力測试工具

    近期在做 压力測试工具,除了apache的ab測试工具外,发现webbentch工具也不错,这里简介下这两个工具. 一.webbentch安装: wget http://blog.s135.com/s ...

  6. ajax短信验证码-mvc

    <script type="text/javascript"> function SendMessage() { var phoneNumberInput = docu ...

  7. NTAG 标签

    NTAG 标签 这里描述针对 NTAG213.而 NTAG215/216只是容量不同,其它功能都一样.  UID UID 有 7 bytes.上图中有 9 bytes 的 serial number ...

  8. datatables参数配置详解

    //@translator codepiano //@blog codepiano //@email codepiano.li@gmail.com //尝试着翻译了一下,难免有错误的地方,欢迎发邮件告 ...

  9. SICP 习题 (1.38)解题总结

    SICP 习题1.38 紧跟着习题1.37的方向,要求我们用习题1.37中定义的cont-frac过程计算数学家欧拉大师在论文De Fractionibus Continuis 中提到的e-2的连分式 ...

  10. 使用Entity Framework和WCF Ria Services开发SilverLight之6:查找指定字段

    对数据库表指定字段的查找,又是实际工作中的一项必要工作.SL客户端仅获取实际需要的指定的字段,好处很多,比如:有助于减少网络流量. 有两类这样的使用场景. 1:联表查询不需要外键表 在上一篇中,我们使 ...