Problem H. Huashui Clock

For those who don’t speak Chinese, huashui may not even be a legitimate word for you. You don’t haveto know what it is to solve this problem, but to make everything clear, huashui refers to the status ofnot working, especially at working hours.

Some people decide to make some plans on when to work, and when to huashui. So they invent alockscreen app with a built-in clock. This clock is just like any other usual clock, except that it hashhours a day andmminutes an hour. Indicator of seconds is not displayed in the app, so you can safelyignore that. Therefore the time display ranges from “0 : 0” to “h−1 :m−1”.

Well, the plan works like this: if the minute number is greater than or equal to the hour number, thisminute is a “huashui minute”; otherwise you are going to work.

You are a hard-worker, and you probably disdain the idea of this clock; but Donald, as a huashui-lover,is obsessed with this app and would very much like to know how much time in a day he can huashui.Help him calculate that and you will win a balloon.

Input

The only line of the input consists of two integershandm(2≤h, m≤109), with space between.

Output

Output huashui time divided by the length of time in a day in a reduced fraction form.

Example

Note

It would be interesting if you have got a “Wrong Answer” on this problem and did not do it on purpose.

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long h, m;
    scanf("%lld %lld", &h, &m);
    long long rex = 0, rey;
    if(h>=m)
    {
        rex = (1+m)*m/2;
    }
    else rex = h*m-(h-1)*h/2;
    rey = h*m;
    long long re = __gcd(rex, rey);
    printf("%lld/%lld\n", rex/re, rey/re);
    return 0;
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值