#P15921. [TOPC 2023] Exponentiation
[TOPC 2023] Exponentiation
题目描述
Exponentiation is a mathematical operation that involves raising a base number to a certain exponent to obtain a result. In the expression , where is the base and is the exponent, it means multiplying by itself times. The result of this operation is called the exponentiation of to the -th power. For examples, and . In these examples, 2 is the base, 3 is the exponent in the first case, and 5 is the base, and 2 is the exponent in the second case. Exponentiation is a fundamental operation in mathematics and is commonly used in various contexts, such as solving equations, and cryptography.
In many cryptographic algorithms, particularly those based on number theory like RSA (Rivest-Shamir-Adleman) and Diffie-Hellman, modular exponentiation is a fundamental operation. Modular exponentiation involves raising a base to an exponent modulo a modulus. This operation is computationally intensive but relatively easy to perform, even for very large numbers.
Let where is a positive integer. Please write a program to compute for given positive integers and .
输入格式
The input has only one line, and it contains three space-separated positive integers , and .
输出格式
Output . If there are multiple solutions, you may output any of them in the range from to .
1 2 3
2
5 4 321
206
3 3 333
18
8 8 888
626
提示
Note
can be a complex number. For example, is either or if . However, is always an integer in this problem.
, and are positive integers less than . You may assume is an integer.