Algorithm/Math (1) 썸네일형 리스트형 Miller–Rabin primality test && Pollard's rho algorithm [BOJ 4149]의 코드로 설명을 대신하겠다. 왜 클래스의 이름을 거창하게 'number theory' 라고 지었는지는 비밀이다. :) #include using namespace std; #define fastio ios::sync_with_stdio(0),cin.tie(0),cout.tie(0) typedef long long ll; typedef __int128 i128; typedef vector vec; struct int_nt { ll mul(ll x,ll y,ll mod) { return (i128)x*y%mod; } ll gcd(ll x,ll y) { for(;y;x%=y,swap(x,y)); return x; } ll lcm(ll x,ll y) { return x/gcd(x,y)*y; .. 이전 1 다음