Masala #QMB4YASHMC
Ketma-ketlik a/b
Quyidagi ketma-ketlik mavjud:
\[\frac{1}{1}, \frac{2}{1}, \frac{1}{2}, \frac{3}{1}, \frac{2}{2}, \frac{1}{3}, \frac{4}{1}, \frac{3}{2}, ... \frac{a}{b}, ...\]Ushbu ketma-ketlikda \(\frac{a}{b}\) nechanchi o'rinda joylashgan?
Kiruvchi ma'lumotlar:
Kirish faylida ikkita butun son - a va b kiritiladi \((1 \le a, b \le 10^9)\).
Chiquvchi ma'lumotlar:
Yuqoridagi element ro'yxatning nechanchi o'rnida turganini chop eting.
Misollar
# | input.txt | output.txt |
---|---|---|
1 |
4 5 |
33 |
2 |
3 3 |
13 |
3 |
1 4 |
10 |