A. Die Roll

题目连接:

http://www.codeforces.com/contest/9/problem/A

Description

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 Input

4 2

Sample Output

1/2

Hint

题意

有三个人在玩掷骰子,然后第一个人扔了个A,第二个人扔了个B

现在问你有多大的概率能够赢过这两个人,平局也算自己赢。

题解:

水题啦

要求化简成为最简单的分数,这个用gcd就好了

代码

#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b)
{
if(b==0)return a;
return gcd(b,a%b);
}
int main()
{
int a,b;
scanf("%d%d",&a,&b);
a=max(a,b);
printf("%d/%d",(7-a)/gcd(7-a,6),6/gcd(7-a,6));
}

最新文章

  1. react-native-vector-icons的简单使用,图片,按钮,标签视图,导航条
  2. 各大主流.Net的IOC框架性能测试比较
  3. PHP判断文件夹是否存在和创建文件夹的方法(递归创建多级目录)
  4. mysql数据向Redis快速导入
  5. 关于VOID *在cl与gcc的不同(无意中发现)
  6. Java编程陷阱-类成员初始化
  7. sql server 2008 case when
  8. 04--帮助类ScreenAdapter编写
  9. Qt入门学习——Qt 5 帮助文档的使用
  10. POJ1985 DFS【STL__vector_的应用】
  11. gets、scanf和getchar之间的区别
  12. MAC 配置--Tomcat服务器
  13. web.confgi转换,web发布时发布配置(debug/release)生成不同的配置文件
  14. ibatis的动态sql
  15. Vue框架Element的事件传递broadcast和dispatch方法分析
  16. React事件杂记及源码分析
  17. 使用Composer安装Symfony
  18. vue-cli脚手架安装和webpack-simple模板项目生成
  19. java正则积累
  20. 学习windows编程 day3 之滚动条完善

热门文章

  1. 高性能优秀的服务框架-dubbo介绍
  2. Vuex-Action
  3. skb_reserve(skb,2)中的2的意义
  4. 用ELK搭建简单的日志收集分析系统【转】
  5. C语言调用正则表达式
  6. 用OpenSSL命令行生成证书文件
  7. 【严蔚敏】【数据结构题集(C语言版)】1.17 求k阶斐波那契序列的第m项值的函数算法
  8. java EE : http 协议之请求报文、响应报文
  9. React.js学习之理解JSX和组件
  10. Java学习笔记之:Java Servlet 过滤器配置