【水枚举】#9 A. Die Roll

A. Die Roll
time limit per test
1 second
memory limit per test
64 megabytes
input
standard input
output
standard output

Yakko, Wakko and Dot, world-famous animaniacs, decided to rest from acting in cartoons, and take a leave to travel a bit. Yakko dreamt to go to Pennsylvania, his Motherland and the Motherland of his ancestors. Wakko thought about Tasmania, its beaches, sun and sea. Dot chose Transylvania as the most mysterious and unpredictable place.

But to their great regret, the leave turned to be very short, so it will be enough to visit one of the three above named places. That's why Yakko, as the cleverest, came up with a truly genius idea: let each of the three roll an ordinary six-sided die, and the one with the highest amount of points will be the winner, and will take the other two to the place of his/her dreams.

Yakko thrown a die and got Y points, Wakko — W points. It was Dot's turn. But she didn't hurry. Dot wanted to know for sure what were her chances to visit Transylvania.

It is known that Yakko and Wakko are true gentlemen, that's why if they have the same amount of points with Dot, they will let Dot win.

Input

The only line of the input file contains two natural numbers Y and W — the results of Yakko's and Wakko's die rolls.

Output

Output the required probability in the form of irreducible fraction in format «A/B», where A — the numerator, and B — the denominator. If the required probability equals to zero, output «0/1». If the required probability equals to 1, output «1/1».

Sample test(s)
input
4 2
output
1/2
Note

Dot will go to Transylvania, if she is lucky to roll 4, 5 or 6 points.


有3个人掷骰子玩,A、B都扔过了,问C不小于这两个的概率,水题啦水题~不说啥啦~

C++:

#include<iostream>
using namespace std;

int main(){
	int n,m;
	cin>>n>>m;// max one
	if(n<m) n=m;
	if(n==1) cout<<"1/1"<<endl;
	else if(n==2) cout<<"5/6"<<endl;
	else if(n==3) cout<<"2/3"<<endl;
	else if(n==4) cout<<"1/2"<<endl;
	else if(n==5) cout<<"1/3"<<endl;
	else cout<<"1/6"<<endl;
	return 0;
}



Python:

# input
list = raw_input().split()
x = max(int(list[0]) , int(list[1]))

def gcd(a , b):
    if b == 0:
       return a
    return gcd(b , a%b)

a = 6-x+1
b = 6

print "%d/%d" % (a/gcd(a,b) , b/gcd(a,b))

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

糖果天王

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值