到底是哪裡錯了?
說第五筆的答案是
1 2 3
#include <stdio.h>
#include <string.h>
char str[10000000];
int main () {
long long i, a, b, if_a, if_b;
while (gets(str) != NULL) {
a = 0;
b = 0;
if_a = 1;
if_b = 0;
for (i = 0; i < strlen(str); i++) {
if (if_a && '0' <= str[i] && str[i] <= '9') {
a *= 10;
a += (long long)(str[i] - '0');
if (if_a && (str[i+1] > '9' || str[i+1] < '0')) {
if_a = 0;
if_b = 1;
continue;
}
}
if (if_b && '0' <= str[i] && str[i] <= '9') {
b *= 10;
b += (long long)(str[i] - '0');
if (if_b && (str[i+1] > '9' || str[i+1] < '0')) {
if_b = 0;
}
}
}
printf("%lld %lld %lld\n", a, b, a+b);
}
return 0;
}