zoukankan      html  css  js  c++  java
  • 快读 快写

    嗯~~~这俩玩意 很毒瘤,但是也很管用

    我的某位超级巨的巨佬有一次因为用了快读,莫名其妙变30分,啦啦啦~~~

    下面让我们来看看正确的快读快写

     1 int buf[17];
     2 inline void read(int &x){
     3     char ch=getchar(); x=0;
     4     while(ch<'0') ch=getchar();
     5     while(ch>='0' && ch<='9') x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
     6 }
     7 inline void write(int x){
     8     if(!x){putchar('0');putchar('
    ');return;}
     9     register int cnt=0;
    10     while(x)buf[++cnt]=(x%10)+48,x/=10;
    11     while(cnt)putchar(buf[cnt--]);
    12     putchar('
    ');
    13 }

    这才对嘛很管用!!!

    不要像某位巨佬一样哦~~~

    找到一个不要数组的快写 666666666

    1 inline void write(int x){
    2     int y=10,len=1;
    3     while(y<=x)    {y*=10;len++;}
    4     while(len--){y/=10;putchar(x/y+48);x%=y;}
    5 }
  • 相关阅读:
    第一次作业
    1-10的四则运算
    实验九
    实验五
    实验四
    实验三
    实验二
    实验一
    汇编第一章总结
    实验九
  • 原文地址:https://www.cnblogs.com/wangyifan124/p/10319878.html
Copyright © 2011-2022 走看看