输入挂

int类型

 1 int Read()
 2 {
 3     int fu=1,ret=0;
 4     char c=getchar();
 5     while(c<'0'||c>'9')
 6     {
 7         if(c=='-')
 8             fu=-1;
 9         c=getchar();
10     }
11     while(c>='0'&&c<='9')
12     {
13         ret=(ret<<3)+(ret<<1)+c-'0';
14         c=getchar();
15     }
16     return ret*fu;
17 }

ll 类型

 1 #include<cstdio>
 2 #include<algorithm>
 3 #include<math.h>
 4 #include<string.h>
 5 #include<queue>
 6 #include<iostream>
 7 using namespace std;
 8 typedef long long LL;
 9 LL Read()
10 {
11     LL fu=1,ret=0;
12     char c=getchar();
13     while(c<'0'||c>'9'){
14         if(c=='-') fu=-1;
15         c=getchar();
16     }
17     while(c>='0'&&c<='9'){
18         ret=(ret<<3)+(ret<<1)+c-'0';
19         c=getchar();
20     }
21     return ret*fu;
22 }
23 int main()
24 {
25     LL tmp;
26     tmp=Read();
27     printf("%lld\n",tmp);
28     return 0;
29 }

 

posted @ 2019-11-08 21:44  古比  阅读(139)  评论(0编辑  收藏  举报