您的位置:首页 > 其它

uva 465 Overflow

2014-03-29 15:46 316 查看
本题我自己的代码提交上去总是WA,自己运行感觉是对的,大家如果看到了我的代码错在哪里了,或能给出使我的结果错误的测试数据,请及时指出。

题目如下:

Overflow

Write a program that reads an expression consisting of two non-negative integer and an operator. Determine if either

integer or the result of the expression is too large to be represented as a ``normal'' signed integer (type integer if you

are working Pascal, type int if you are working in C).

Input

An unspecified number of lines. Each line will contain an integer, one of the two operators + or *, and another integer.

Output

For each line of input, print the input followed by 0-3 lines containing as many of these three messages as are

appropriate: ``first number too big'', ``second number too big'', ``result too big''.

Sample Input

300 + 3

9999999999999999999999 + 11

Sample Output

300 + 3

9999999999999999999999 + 11

first number too big

result too big

我的代码(WA)

网上的这个代码用了atof函数,将字符串转化为浮点型,非常简洁的代码

如下(AC)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: