@[kingcxp](/space/show?uid=75304) @[memset0](/space/show?uid=53495) @[OvO自动机](/space/show?uid=122689) 我又试了一下,cout<<t全ac,printf("%c",t)就又wa了。洛谷的系统可能真的有问题吧
WA的代码:
```c
#include<stdio.h>
int a,i=0;
char c,t;
char get(int n){
if(n){
if((t=get(n-1))!=get(n-1)) t='F';
}
else{
scanf("%c",&c);
if(c-48) t='I';
else t='B';
}
printf("%c",&c);
return t;
}
int main(){
scanf("%d",&a);
getchar();
getchar();
get(a);
return 0;
}
```
AC的代码:
```cpp
#include<bits/stdc++.h>
using namespace std;
int a,i=0;
char c,t;
char get(int n){
if(n){
if((t=get(n-1))!=get(n-1)) t='F';
}
else{
scanf("%c",&c);
if(c-48) t='I';
else t='B';
}
cout<<t;
return t;
}
int main(){
scanf("%d",&a);
getchar();
getchar();
get(a);
return 0;
}
```
by CrystalRays @ 2019-09-21 14:23:42
@[CrystalRays](/space/show?uid=253826) 那个啥……`iostream`里的东西真的是有很多特性的 比如`cin>>`字符会自动跳过空格、`\r`、`\n`、`\t`等空字符
字符处理本来就是有很多问题,这个还是用`putchar()`更靠谱一点
这些都是猜测,具体问题蒟蒻也不清楚……
by OvOAuto @ 2019-09-21 15:52:59
再加上GNU本身的问题?C++11等衍生版本的问题?
by OvOAuto @ 2019-09-21 15:53:47
我找到你的bug了,以上我说的全是废话
```cpp
printf("%c",&c);
```
你输出地址了……
by OvOAuto @ 2019-09-21 15:55:28
还是仔细看看吧 我也有过输出地址的经历……
从此以后都是`sync_with_stdio(false)`+`fread()`+重载运算符`>>`到`fread()`这样的处理方式
然后就可以用魔改版的超快`cin` `cout`啦
by OvOAuto @ 2019-09-21 15:58:37
@[OvO自动机](/space/show?uid=122689) 感谢QAQ
by CrystalRays @ 2019-09-21 23:03:56
##### ~~总有人喜欢用getchar读字符串然后锅掉了说是评测机的问题~~
by lucas1522 @ 2019-10-10 13:14:30