Problem Description
Loading...
Problem Analysis
If we compute the power normally, we can use Fast Exponentiation
cpp
| |
Using the congruence theorem, we can find the last digit
cpp
| |
Otherwise, finding the pattern and precomputing a table is also a viable approach
cpp
| |
Recommended blog: HDU OJ (HDOJ) Problem 1097: A hard puzzle (Number Theory)