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