A10162 | The Big Race
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Vector Willman and Array Bolt are the two most famous athletes of Byteforces. They are going to compete in a race with a distance of $L$ meters today.
Willman and Bolt have exactly the same speed, so when they compete the result is always a tie. That is a problem for the organizers because they want a winner.
While watching previous races the organizers have noticed that Willman can perform only steps of length equal to $w$ meters, and Bolt can perform only steps of length equal to $b$ meters. Organizers decided to slightly change the rules of the race. Now, at the end of the racetrack there will be an abyss, and the winner will be declared the athlete, who manages to run farther from the starting point of the the racetrack (which is not the subject to change by any of the athletes).
Note that none of the athletes can run infinitely far, as they both will at some moment of time face the point, such that only one step further will cause them to fall in the abyss. In other words, the athlete will not fall into the abyss if the total length of all his steps will be less or equal to the chosen distance $L$ .
Since the organizers are very fair, the are going to set the length of the racetrack as an integer chosen randomly and uniformly in range from 1 to $t$ (both are included). What is the probability that Willman and Bolt tie again today?
Willman and Bolt have exactly the same speed, so when they compete the result is always a tie. That is a problem for the organizers because they want a winner.
While watching previous races the organizers have noticed that Willman can perform only steps of length equal to $w$ meters, and Bolt can perform only steps of length equal to $b$ meters. Organizers decided to slightly change the rules of the race. Now, at the end of the racetrack there will be an abyss, and the winner will be declared the athlete, who manages to run farther from the starting point of the the racetrack (which is not the subject to change by any of the athletes).
Note that none of the athletes can run infinitely far, as they both will at some moment of time face the point, such that only one step further will cause them to fall in the abyss. In other words, the athlete will not fall into the abyss if the total length of all his steps will be less or equal to the chosen distance $L$ .
Since the organizers are very fair, the are going to set the length of the racetrack as an integer chosen randomly and uniformly in range from 1 to $t$ (both are included). What is the probability that Willman and Bolt tie again today?
输入格式
The first line of the input contains three integers $t$ , $w$ and $b$ ( $1<=t,w,b<=5·10^{18}$ ) — the maximum possible length of the racetrack, the length of Willman's steps and the length of Bolt's steps respectively.
输出格式
Print the answer to the problem as an irreducible fraction . Follow the format of the samples output.
The fraction  ( $p$ and $q$ are integers, and both $p>=0$ and $q>0$ holds) is called irreducible, if there is no such integer $d>1$ , that both $p$ and $q$ are divisible by $d$ .
The fraction  ( $p$ and $q$ are integers, and both $p>=0$ and $q>0$ holds) is called irreducible, if there is no such integer $d>1$ , that both $p$ and $q$ are divisible by $d$ .
输入输出样例
输入 #1
10 3 2
输出 #1
3/10
输入 #2
7 1 2
输出 #2
3/7
In the first sample Willman and Bolt will tie in case $1$ , $6$ or $7$ are chosen as the length of the racetrack.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted