码迷,mamicode.com
首页 > 其他好文 > 详细

读入输出优化

时间:2018-01-28 18:17:30      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:class   main   oid   nbsp   lib   getc   cst   turn   mat   

代码

#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;
}

读入输出优化

标签:class   main   oid   nbsp   lib   getc   cst   turn   mat   

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

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