随笔分类 -  Learning

摘要:最近发现简单题目所花费时间都很多,原因是cin, cout效率太低因为C++为了兼容C,所以读取时效率降低这个兼容可以设置,在关闭后,发现效率比scanf, printf都要高关闭C++标准stream(cin, cout, cerr)与C标准程序库文件(stdin, stdout,stderr)的同步,加上这样一行语句即可 ios::sync_with_stdio(false);效果:cin, cout,AC需要250msscanf, printf,AC需要78ms加上ios::sync_with_stdio(false); cin, cout,AC需要62ms 阅读全文
posted @ 2013-01-24 16:14 tjsuhst 阅读(678) 评论(0) 推荐(0)