首页 > 其他 > 详细

读入输出优化

时间:2018-01-28 18:02:53      阅读:151      评论:0      收藏:0      [点我收藏+]

代码

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<ctime>
#include<vector>
#include<set>
#include<map>
#include<stack>
using namespace std;
void read(int &x){
      int f=1;x=0;
      char s=getchar();
      while(s<‘0‘||s>‘9‘){if(s==‘-‘)f=-1;s=getchar();}
      while(s>=‘0‘&&s<=‘9‘){x=x*10+(s-‘0‘);s=getchar();}
      x*=f;
}
void print(int x){
      if(x<0){putchar(‘-‘);x=-x;}
      if(x>9)print(x/10);
      putchar(x%10+‘0‘);
}
int main()
{     int n;
      read(n);
      print(n);
      return 0;
}

读入输出优化

原文:https://www.cnblogs.com/yzxverygood/p/8371669.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!