cp-library

競技プログラミング用 C++ ライブラリ

View the Project on GitHub qandori/cp-library

:heavy_check_mark: test/mod_pow_log.test.cpp

test/mod_pow_log.test.cpp · GitHub で見る

検証問題

依存ライブラリ

コード

#define PROBLEM "https://judge.yosupo.jp/problem/discrete_logarithm_fixed_mod"
#include "math/mod_pow.hpp"
#include "components/fast_io.hpp"

int main() {
	FastInput input;
	FastOutput output;
	std::uint32_t p = 0, g = 0;
	int n = 0;
	input.read(p), input.read(g), input.read(n);
	ModPow power(p, g);
	while (n--) {
		std::uint32_t a = 0;
		input.read(a);
		output.println(power.log(a));
	}
}
Back to top page