关闭

xtu 1268 Strange Optimization 湘潭邀请赛I

267人阅读 评论(0) 收藏 举报
分类:

Strange Optimization

Bobo is facing a strange optimization problem. Given n,m, he is going to find a real number α such that f(12+α) is maximized, where f(t)=mini,jZ|injm+t|. Help him!

Note: It can be proved that the result is always rational.

Input

The input contains zero or more test cases and is terminated by end-of-file.

Each test case contains two integers n,m.

  • 1n,m109
  • The number of tests cases does not exceed 104.

Output

For each case, output a fraction p/q which denotes the result.

Sample Input

1 1
1 2

Sample Output

1/2
1/4

Note

For the first sample, α=0 maximizes the function.


Source

XTU OnlineJudge
#include<stdio.h>

#define ll __int64
ll gcd(ll a,ll b)
{
    return a%b==0?b:gcd(b,a%b);
}

int main()
{
    ll a,b;
    while(~scanf("%I64d %I64d",&a,&b))
    {
        printf("1/%I64d\n",2*a*b/gcd(a,b));
    }
    return 0;
}


1
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:50316次
    • 积分:2084
    • 等级:
    • 排名:第19149名
    • 原创:160篇
    • 转载:30篇
    • 译文:0篇
    • 评论:1条
    文章分类
    最新评论