report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Binary exponentiation - FlandreOJ: Flandre Online Judge

Binary exponentiation

Time limit: 1000 ms
Memory limit: 256 MB
Given 3 integers $a, b, c$. Calculate: $$a ^ b \mod c$$ ### Input - The first line contains 3 integers $a, b, c$. ### Output - Print $a ^ b \mod c$. ### Constraints - $1 \le a, b, c \le 10^{18}$. ### Example Input: ``` 3 6 5 ``` Output: ``` 4 ```
Binary exponentiation
Overflow
Binary exponentiation
Number counting
Topic
Math
Rating 800
Solution (1) Solution