快速的输入输出功能

编程入门 行业动态 更新时间:2024-10-27 15:26:21
本文介绍了快速的输入输出功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 #define getcx getchar_unlocked inline void inp( int &n )//fast input function { n=0; int ch=getcx();int sign=1; while( ch < '0' || ch > '9' ){if(ch=='-')sign=-1; ch=getcx();} while( ch >= '0' && ch <= '9' ) n = (n<<3)+(n<<1) + ch-'0', ch=getcx(); n=n*sign; }

您好我一直在使用输入上述功能在不同的编码比赛,但为什么它快速始终无法理解。我所知道的逻辑,但不知道它的牢度的概念。例如这是什么线做getchar_unlocked的#define getcx。此外,我不知道任何快速输出功能,因此没有任何快速输出功能还可

Hi I have been using the above function for input in various coding contests but was never able to understand why is it fast. I know the logic but don't know the concept of it's fastness. For example what is this line doing "#define getcx getchar_unlocked" . Also I don't know any fast output function so is there any fast output function also

推荐答案

的的#define 使用preprocessor使 getcx 是一个短手功能 getchar_unlocked() ,这是一种非锁定字符阅读功能

The #define uses the preprocessor to make getcx be a short-hand for the function getchar_unlocked(), which is a non-locking character-reading function.

这是一个有点真棒,你已经在多个编码竞赛竞争不理解这个pretty基础件C的。

It's a bit awesome that you've competed in several coding contests without understanding this pretty basic piece of C.

该手册页我联系上面提到 putc_unlocked()这听起来像pretty同样的事情,但输出。

The manual page I linked to above mentions putc_unlocked() which sounds like pretty much the same thing but for output.

更多推荐

快速的输入输出功能

本文发布于:2023-11-26 04:39:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1632658.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:输入输出   快速   功能

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!