__int128
__int128 __uint128 __int128_t __uint128_t
大小:16字节 2^128(sizeof())
2^128 39位 340282366920938463463374607431768211456
Codeblocks 无法使用,Dev C++ 可以使用,有时候比赛能用
Problem:A+B
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1
1 #include <cstdio> 2 #include <cstdlib> 3 #include <cmath> 4 #include <cstring> 5 #include <time.h> 6 #include <string> 7 #include <set> 8 #include <map> 9 #include <list> 10 #include <stack> 11 #include <queue> 12 #include <vector> 13 #include <bitset> 14 #include <ext/rope> 15 #include <algorithm> 16 #include <iostream> 17 using namespace std; 18 #define ll long long 19 #define minv 1e-6 20 #define inf 1e9 21 #define pi 3.1415926536 22 #define E 2.7182818284 23 const ll mod=1e9+7;//998244353 24 const int maxn=1e2+10; 25 26 inline void read(__int128 &x) 27 { 28 bool f=0; 29 char ch; 30 if ((ch=getchar())==EOF) 31 exit(0); 32 while (ch<'0' || ch>'9') 33 f|=ch=='-',ch=getchar(); 34 x=0; 35 while (ch>='0' && ch<='9') 36 x=(x<<3)+(x<<1)+ch-'0',ch=getchar(); 37 if (f) 38 x=-x; 39 } 40 41 void write(__int128 &x) 42 { 43 int a[50],w=0,i; 44 bool f=0; 45 if (x<0) 46 f=1,x=-x; 47 while (x) 48 { 49 a[++w]=x%10; 50 x/=10; 51 } 52 ///putchar:faster 53 if (f) 54 putchar('-'); 55 for (i=w;i>=1;i--) 56 putchar(a[i]+'0'); 57 if (w==0) 58 putchar('0'); 59 putchar('\n'); 60 } 61 62 int main() 63 { 64 __int128 x,y; 65 while (1) 66 { 67 read(x); 68 read(y); 69 x+=y; 70 write(x); 71 } 72 return 0; 73 }