我一直在尝试 Codeforces 提交页面上可用的不同编译器,但没有一个不同的编译器提供诸如 Code::Block 之类的输出
问题链接:https ://codeforces.com/problemset/problem/282/A
这是我的代码:
#include <stdio.h>
#include <string.h>
int main() {
int count = 0, i = 0, final;
int x = 0;
char strg[3];
scanf("%d", &count);
for (i = 0; i < count; i++){
scanf("%s", &strg[0], &strg[1], &strg[2]);
if ((strcmp(strg,"x++") == 0) || (strcmp(strg,"++x") == 0)){
x = x+1;
} if ((strcmp(strg,"x--") == 0) || (strcmp(strg,"--x") == 0)){
x = x-1;
}
}
printf("%d", x);
}
提交页面输出:“错误答案第一个数字不同 - 预期:'1',找到:'0'” 但是,Code::Blocks 打印正确的值是“1”。
Codeforces 提交:
程序运行输出:

