用C++的千万不要用cin,cout

测试数据 #0: Accepted, time = 0 ms, mem = 1068 KiB, score = 10
测试数据 #1: Accepted, time = 15 ms, mem = 1068 KiB, score = 10
测试数据 #2: Accepted, time = 46 ms, mem = 1060 KiB, score = 10
测试数据 #3: Accepted, time = 109 ms, mem = 1064 KiB, score = 10
测试数据 #4: Accepted, time = 452 ms, mem = 1060 KiB, score = 10
测试数据 #5: Accepted, time = 655 ms, mem = 1064 KiB, score = 10
测试数据 #6: Accepted, time = 468 ms, mem = 1064 KiB, score = 10
测试数据 #7: TimeLimitExceeded, time = 1014 ms, mem = 1064 KiB, score = 0
测试数据 #8: TimeLimitExceeded, time = 1014 ms, mem = 1064 KiB, score = 0
测试数据 #9: Accepted, time = 0 ms, mem = 1064 KiB, score = 10
TimeLimitExceeded, time = 3773 ms, mem = 1068 KiB, score = 80

这就用cin,cout的后果
于是改用printf,scanf

测试数据 #0: Accepted, time = 0 ms, mem = 1308 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 1304 KiB, score = 10
测试数据 #2: Accepted, time = 15 ms, mem = 1308 KiB, score = 10
测试数据 #3: Accepted, time = 7 ms, mem = 1308 KiB, score = 10
测试数据 #4: Accepted, time = 31 ms, mem = 1304 KiB, score = 10
测试数据 #5: Accepted, time = 46 ms, mem = 1312 KiB, score = 10
测试数据 #6: Accepted, time = 31 ms, mem = 1304 KiB, score = 10
测试数据 #7: Accepted, time = 93 ms, mem = 1312 KiB, score = 10
测试数据 #8: Accepted, time = 78 ms, mem = 1304 KiB, score = 10
测试数据 #9: Accepted, time = 0 ms, mem = 1304 KiB, score = 10
Accepted, time = 301 ms, mem = 1312 KiB, score = 100

完全无力了

9 条评论

  • @ 2015-08-02 15:16:53

    orz

  • @ 2015-02-13 23:04:59

    Linux平台上运行程序普遍比Windows上快。
    Windows下VC编译的程序一般运行比MINGW(MINimal Gcc for Windows)快。
    VC对cin取消同步与否不敏感,前后效率相同。反过来MINGW则非常敏感,前后效率相差8倍。
    read本是linux系统函数,MINGW可能采用了某种模拟方式,read比fread更慢。
    Pascal程序运行速度实在令人不敢恭维。

  • @ 2014-10-31 19:03:33

    Orz

  • @ 2014-10-30 23:25:09

    orz

  • @ 2014-10-30 13:38:05

    #define fin cin
    #define fout cout
    using namespace std;
    void init()
    {

    }
    int main()
    {
    ios::sync_with_stdio(false);
    ifstream fin("culture.in");
    ofstream fout("culture.out");

    return 0;
    }

    • @ 2014-10-31 19:11:40

      ios::sync_with_stdio(false);对fstream也有用吗
      我怎么感觉只对cin cout有用

  • @ 2014-10-29 22:23:13

    其实我更喜欢用fin,fout----保准你不会超时。。。。。。
    来来来,告诉你格式:
    ifstream fin("in.in");
    ofstream fout("out .out");
    fin>>a;
    fout<<a;
    fin.close();
    fout.close();
    绝对简单粗暴!!!

  • @ 2014-10-29 21:11:22

    呃……**偶尔** cin和cout会比scanf和printf快的……真的是偶尔……

  • @ 2014-10-29 05:27:13

    没关同步吧

  • @ 2014-10-29 00:13:45

    orz

  • 1

信息

ID
1816
难度
4
分类
(无)
标签
递交数
2916
已通过
1143
通过率
39%
被复制
7
上传者