report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Overflow - MarisaOJ: Marisa Online Judge

Overflow

Time limit: 1000 ms
Memory limit: 256 MB
Given 3 integers $a, b, c$. Calculate: $$a \times b \mod c$$ ### Input - The first line contains 3 integers $a, b, c$. ### Output - Print $a \times b \mod c$. Note that the value of $a \times b$ may exceed the capacity of a 64-bit integer data type. ### Constraints - $1 \le a, b, c \le 10^{18}$. ### Example Input: ``` 3 6 5 ``` Output: ``` 3 ```
Binary exponentiation
Overflow
Binary exponentiation
Number counting
Topic
Math
Rating 800
Solution (3) Solution