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)
题目如下:
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)
相关文章推荐
- uva 465 Overflow(借助double型进行比较)
- UVa 465 - Overflow
- UVA 465 Overflow(浮点数的范围)
- uva-465(overflow)
- uva-465-Overflow
- UVA - 465 Overflow
- UVA 465 - Overflow
- uva 465 - Overflow 高精度还是浮点数?
- Uva 465 - Overflow
- uva 465 Overflow 还是高精度。。。
- UVA_465_Overflow
- UVa 465 - Overflow
- UVa 465 - Overflow
- UVA - 465 Overflow
- uva465 - Overflow
- UVa 465 Overflow
- UVA 465 Overflow
- UVa 465 Overflow (比较大小难道不应该用double吗)
- UVA - 465 Overflow atof的使用方法
- UVA 465 - Overflow(大数)