码迷,mamicode.com
首页 > 其他好文 > 详细

cin和scanf的速度差别

时间:2017-08-09 21:22:13      阅读:99      评论:0      收藏:0      [点我收藏+]

标签:logs   with   scanf   9.png   没有   技术分享   image   数据   scan   

好长时间没有遇到这种问题了,以前虽然知道scanf比cin快,但是没想到快这么多,见图。

50万的数据。

scanf输入:

技术分享

cin输入:

技术分享

网上说用std::ios::sync_with_stdio(false);可以优化。优化完的速度:

技术分享

还和纯scanf差好多。

cin和scanf的速度差别

标签:logs   with   scanf   9.png   没有   技术分享   image   数据   scan   

原文地址:http://www.cnblogs.com/littlepear/p/7327285.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!