为什么0分

P1957 口算练习题

lighthouse @ 2021-04-03 17:33:16

本地过了,洛谷0分?

#include <bits/stdc++.h>

using namespace std;

char fff,s[20], total[20];

int main(){
    int n, a, b, c;
    cin >> n;
    getchar();
    while(n--){
        fgets(s, sizeof(s), stdin);
        getchar();
        if(s[0] == 'a' || s[0] == 'b' || s[0] == 'c')
            fff = s[0], s[0] = ' ';
        sscanf(s, "%d %d", &a, &b);
        switch(fff){
            case 'a':c = a + b;sprintf(total, "%d+%d=%d", a, b, c);break;
            case 'b':c = a - b;sprintf(total, "%d-%d=%d", a, b, c);break;
            case 'c':c = a * b;sprintf(total, "%d*%d=%d", a, b, c);break;
        }
        printf("%s\n%d\n",total ,strlen(total));
    }
    return 0;
}

by lighthouse @ 2021-04-03 18:52:36

求助神犇

Thanks

by endprophet @ 2021-04-03 23:53:51

我也差不多,本地好好的,在线IDE就会多打出几个不明意义的换行


by endprophet @ 2021-04-03 23:58:01

更离谱的是我下载了数据,打出来的输出和答案的输出一样???


by lighthouse @ 2021-04-05 09:05:51

我也是


by lighthouse @ 2021-04-05 09:07:02

输出与测试点一模一样


by nod1212 @ 2021-05-20 20:50:17

我也是


|