H. Huashui Clock

#include
using namespace std;
int main()
{
   long long int h,m,r,x,y,a,z,b,l,k;
    while(cin>>h>>m&&h&&m)
    {
        if(h==m||h>m)
        {
            x=(m+1)*m/2;
            y=h*m;
            k=x;
            l=y;
        }
        else
        {
            x=h*m-(h-1)*h/2;
            y=h*m;
            k=x;
            l=y;
        }
    while (x!= 0)

	{
		z = y%x;
		y=x;
		x=z;
        a=y;
	}
       cout<

For those who don’t speak Chinese, huashui may not even be a legitimate word for you. You don’t have to know what it is to solve this problem, but to make everything clear, huashui refers to the status of not working, especially at working hours. Some people decide to make some plans on when to work, and when to huashui. So they invent a lockscreen app with a built-in clock. This clock is just like any other usual clock, except that it has h hours a day and m minutes an hour. Indicator of seconds is not displayed in the app, so you can safely ignore 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, this minute 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 integers h and m (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. 

你可能感兴趣的:(H. Huashui Clock)