module AtCoder::Math

Overview

Implements ACL's Math library

Defined in:

math.cr

Class Method Summary

Class Method Detail

def self.crt(remainders, modulos) #

Implements atcoder::crt(remainders, modulos).


[View source]
def self.extended_gcd(a, b) #

[View source]
def self.floor_sum(n, m, a, b) #

Implements atcoder::floor_sum(n, m, a, b).


[View source]
def self.get_primitive_root(p : Int) #

[View source]
def self.inv_mod(value, modulo) #

Implements atcoder::inv_mod(value, modulo).


[View source]
def self.mul_mod(a : Int64, b : Int64, mod : Int64) #

Caluculates a * b % mod without overflow detection


[View source]
def self.mul_mod(a, b, mod) #

[View source]
def self.pow_mod(base, exponent, modulo) #

Simplified AtCoder::Math.pow_mod with support of Int64


[View source]
def self.product_greater_than(a : Int, b : Int, target : Int) #

Returns a * b > target, without concern of overflows.


[View source]