daylight-library

This documentation is automatically generated by competitive-verifier/competitive-verifier

View the Project on GitHub daylight-pro/daylight-library

:heavy_check_mark: 繰り返し2乗法でa^p mod mを求める (daylight/math/powmod.hpp)

Depends on

Required by

Verified with

Code

#pragma once
#include "daylight/base.hpp"
/// @brief 繰り返し2乗法でa^p mod mを求める
ll pow_mod(ll a, ll p, ll m) {
	using i128 = __int128_t;
	i128 ret = 1;
	i128 mul = a;
	for(; p > 0; p >>= 1) {
		if(p & 1) ret = (ret * mul) % m;
		mul = (mul * mul) % m;
	}
	return ll(ret);
}
Traceback (most recent call last):
  File "/home/runner/.local/lib/python3.10/site-packages/competitive_verifier/oj_resolve/resolver.py", line 181, in resolve
    bundled_code = language.bundle(path, basedir=basedir)
  File "/home/runner/.local/lib/python3.10/site-packages/competitive_verifier/oj/verify/languages/cplusplus.py", line 252, in bundle
    bundler.update(path)
  File "/home/runner/.local/lib/python3.10/site-packages/competitive_verifier/oj/verify/languages/cplusplus_bundle.py", line 482, in update
    self.update(
  File "/home/runner/.local/lib/python3.10/site-packages/competitive_verifier/oj/verify/languages/cplusplus_bundle.py", line 477, in update
    raise BundleErrorAt(
competitive_verifier.oj.verify.languages.cplusplus_bundle.BundleErrorAt: daylight/base.hpp: line 103: unable to process #include in #if / #ifdef / #ifndef other than include guards
Back to top page