HUST Online Judge WebBoard
Problem 1103 >> 错误73哪里不对了
202001240303 @ 2021-07-13 10:09:28
[ Quote ] [ Edit ] [ Delete ] 1#
#include<stdio.h>
int main()
{
int i = 0, sum = 0,num=0;
char s[2000], s1[6] = "+";
scanf("%s", &s);

while (s[i])
{

if (s[i] != '+') {
num = num * 10 + s[i]-48;

}
else {

sum = sum + num;
num = 0;
}

i++;


}

sum = sum + num;
printf("%d", sum);

}
202003150201 @ 2021-08-04 21:27:00
[ Quote ] [ Edit ] [ Delete ] 2#
数据很大,要用高精度保存结果