Kyopro Library
 
読み取り中…
検索中…
一致する文字列を見つけられません
int128.hpp
[詳解]
1#pragma once
2#include"../../kyopro_library/template.hpp"
3
4using ull=unsigned long long; using lll=__int128_t;
5constexpr lll operator ""_lll(ull x) { return static_cast<lll>(x); }
6constexpr const lll INFLL=1_lll<<120;
7
8istream& operator>>(istream& is, lll& x) {
9 int c=is.peek();
10 while(c==' '||c=='\n') is.get(), c=is.peek();
11 bool neg=false;
12 if(c=='-') neg=true, is.get();
13 x=0;
14 while(isdigit(is.peek())) x=x*10+is.get()-'0';
15 if(neg) x=-x;
16 return is;
17}
18
19ostream& operator<<(ostream& os, lll x) {
20 if(x<0) os<<'-', x=-x;
21 if(x==0) return os<<'0';
22 string s;
23 while(x>0) s+=x%10+'0', x/=10;
24 reverse(s.begin(),s.end());
25 return os<<s;
26}
27
28#ifdef TDY
29lll abs(lll x) { if (x<0) return -x; return x; }
30lll gcd(lll a, lll b) {
31 while(b) a%=b, swap(a,b);
32 return a;
33}
34#endif
ostream & operator<<(ostream &os, lll x)
Definition int128.hpp:19
constexpr lll operator""_lll(ull x)
Definition int128.hpp:5
constexpr const lll INFLL
Definition int128.hpp:6
istream & operator>>(istream &is, lll &x)
Definition int128.hpp:8