码迷,mamicode.com
首页 > 编程语言 > 详细

加速C++ cin,cout的速度

时间:2019-09-14 19:11:54      阅读:91      评论:0      收藏:0      [点我收藏+]

标签:scan   bsp   col   scanf   代码   返回   syn   加速   std   

用以下两行代码:

    ios::sync_with_stdio(false);   //加速
    cin.tie(0);
  1. 首先sync_with_stdio(false)是为了打断iostream输入输出到缓存,可以节约很多时间,使之与scanf相差无几。
  2. tie是将两个stream绑定的函数,空参数的话返回当前的输出指针,即tie(0)与tie(nullptr)来解决cin与cout的绑定。

 

加速C++ cin,cout的速度

标签:scan   bsp   col   scanf   代码   返回   syn   加速   std   

原文地址:https://www.cnblogs.com/Bella2017/p/11519670.html

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