DMOPC '15 Contest 5 P1 - Gel Bananas

View as PDF

Submit solution


Points: 3 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Okabe and Kurisu are experimenting on bananas. Okabe starts a new experiment every A days, and Kurisu starts a new experiment every B days. Today, on day 1, Okabe and Kurisu both start an experiment. How many times will Okabe and Kurisu start their experiments together in X days?

Input Specification

The first, second and third lines of input will contain A, B (1 \le A, B \le 10^9), and X (1 \le X \le 10^{18}), respectively.

Output Specification

Output a single integer, the number of times that Okabe and Kurisu start their experiments together.

Sample Input

2
3
10

Sample Output

2

Explanation

Okabe will start his experiments on days 1, 3, 5, 7, 9 and Kurisu will start her experiments on days 1, 4, 7, 10. They start their experiments together on days 1 and 7.


Comments