新手,问ACM的一道题
来源:百度知道 编辑:UC知道 时间:2024/05/22 00:35:50
Description
Calculate A-B
Input
Two integer a and b(-10^100 < a,b < 10^100)
Output
Output a-b
Sample Input
1 2
Sample Output
-1
Source
BUPT Online Judge
我提交了,为什么总是WrongAnswer?
是不是数据类型的问题?(-10^100 < a,b < 10^100)
另请教高手详细的数据类型!
Calculate A-B
Input
Two integer a and b(-10^100 < a,b < 10^100)
Output
Output a-b
Sample Input
1 2
Sample Output
-1
Source
BUPT Online Judge
我提交了,为什么总是WrongAnswer?
是不是数据类型的问题?(-10^100 < a,b < 10^100)
另请教高手详细的数据类型!
这个应该是要你求精确解(就是数据溢出的问题),你必须自己写一个字符数组来表示一个整数,比如可以是
unsigned char a[102],b[102];
注意要留一个符号位就行。