Register
|
Login
HOME
PROBLEMSET
ROADMAP
COMPETITION
TOPIC
RANKING
GUIDE
MASHUP
ABOUT
CONTACT
Problem
Submit
Results
Binary exponentiation - MarisaOJ: Marisa Online Judge
Binary exponentiation
Time limit: 1000 ms
Memory limit: 256 MB
Given 3 integers
a
,
b
,
c
a
,
b
,
c
. Calculate:
a
b
mod
c
a
b
mod
c
### Input - The first line contains 3 integers
a
,
b
,
c
a
,
b
,
c
. ### Output - Print
a
b
mod
c
a
b
mod
c
. ### Constraints -
1
≤
a
,
b
,
c
≤
10
18
1
≤
a
,
b
,
c
≤
10
18
. ### Example Input:
3
6
5
3
6
5
Output:
4
4
Binary exponentiation
Overflow
Binary exponentiation
Number counting
Topic
Math
Rating
800
Solution (1)
Solution