Open utterances-bot opened 5 years ago
我记得快输用的是递归吧......这样直接printf
不就没意思了吗QwQ
@SocialZxy
我记得快输用的是递归吧......这样直接
printf
不就没意思了吗QwQ
递归?怎么个递归法?我觉得重载运算符更好啊。。。而且我总觉得printf
在有些时候比putchar
更快啊QAQ
void write(int x)
{
if(x<0) putchar('-'),x=-x;
if(x>9) write(x/10);
putchar(x%10+'0');
}
话说你是怎么回复的啊QwQ
@0And1Story
@SocialZxy
void write(int x) { if(x<0) putchar('-'),x=-x; if(x>9) write(x/10); putchar(x%10+'0'); }
话说你是怎么回复的啊QwQ
像这样:
@SocialZxy
> ```cpp
> void write(int x)
> {
> if(x<0) putchar('-'),x=-x;
> if(x>9) write(x/10);
> putchar(x%10+'0');
> }
> ```
>
> 话说你是怎么回复的啊QwQ
还有我觉得用递归的话好像比printf
更慢呢。。。
@0And1Story 您测一下不就知道了(
@SocialZxy
@0And1Story 您测一下不就知道了(
以前我测过一次,printf("%s")
比putchar
更快。。。
快读 - 0And1Story Blog
undefined
https://0and1story.github.io/BlogPostAssets/articles/fast-io.html