CF592C.The Big Race

普及+/提高

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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?

向量·威尔曼(Vector Willman)和数组·博尔特(Array Bolt)是字节力场(Byteforces)最著名的两位运动员。今天他们将参加一场长度为 LL 米的赛跑。

威尔曼与博尔特的速度完全相同,因此在以往的比赛中,结果总是平局。这对主办方而言是个问题,因为他们希望决出一位胜者。

主办方在观看过往比赛时注意到:威尔曼每次只能迈出长度恰好为 ww 米的步子,而博尔特每次只能迈出长度恰好为 bb 米的步子。于是主办方决定略微修改比赛规则:现在赛道终点处将设有一道深渊,最终获胜者将是从赛道起点出发后跑得更远的那位运动员(起点位置不可被任何运动员更改)。

注意:两位运动员均无法无限奔跑,因为他们在某一时刻必将到达这样一个位置——再向前迈出一步就会坠入深渊。换言之,只要某位运动员所有步长的总和 小于或等于 所选定的赛道长度 LL,他就不会坠入深渊。

由于主办方非常公平,他们将随机、均匀地从区间 [1,t][1, t](含端点)中选择一个整数作为赛道长度 LL。那么,今天威尔曼与博尔特再次打成平局的概率是多少?

输入格式

The first line of the input contains three integers t, w and b (1 ≤ t, w, b ≤ 5·1018) — the maximum possible length of the racetrack, the length of Willman's steps and the length of Bolt's steps respectively.

输入的第一行包含三个整数 tt、ww 和 bb(1 ≤ t, w, b ≤ 5⋅10181 ≤ t, w, b ≤ 5·10^{18}),分别表示赛道的最大可能长度、Willman 的步长以及 Bolt 的步长。

输出格式

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.

以最简分数形式输出该问题的答案:。请遵循样例输出的格式。

分数 (其中 p 和 q 为整数,且满足 p ≥ 0、q > 0)称为最简分数,当且仅当不存在整数 d > 1,使得 p 和 q 均能被 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.

在第一个样例中,当赛道长度选择为 1、6 或 7 时,Willman 和 Bolt 将打成平手。

输入解题思路,AI测评打分。不知道怎么写?

首页