首页 > 其他 > 详细

__int128

时间:2018-11-18 11:19:00      阅读:196      评论:0      收藏:0      [点我收藏+]


__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 }

 

__int128

原文:https://www.cnblogs.com/cmyg/p/9977116.html

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