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
题意:三个人置筛子,如今给出前两个人的点数,仅仅要第三个人的点数大于等于前两个人的,第3个则胜出,求第三个人胜出的概率,假设是0 输出0/1 假设是1
输出1/1 否则 化简后按分数模式输出 事实上细致一想第三个不可能输的。。。

即使前两人点数都为6 第三个人胜出的概率也有1/6 
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
using namespace std;
#define LL long long
int gcd(int a,int b)
{
if(b==0)
return a;
else
return gcd(b,a%b);
}
int main()
{
int x,y;
while(cin>>x>>y)
{
int t=6-max(x,y)+1;
if(t==6)
{
puts("1/1");
continue;
}
printf("%d/%d\n",t/gcd(t,6),6/gcd(t,6));
}
return 0;
}

版权声明:本文博主原创文章,博客,未经同意不得转载。

最新文章

  1. [Skills] 在桌面打开一个BAT文件,CMD窗口不关闭
  2. Java眼中的XML--文件读取--2 应用SAX方式解析XML
  3. 关于hangfire的使用
  4. Ubuntu sudo NOPASSWD设置
  5. 利用Google GCM发送push通知到Android客户端
  6. oracle 两个时间相减
  7. NYOJ 330 一个简单的数学
  8. Map 根据value 排序
  9. Eeffective C++ 读书笔记( 32-38)
  10. Linux查看当前目录下所有子目录是否包含某个文件
  11. 加载Excel时,如何过滤空行空列
  12. LoadRunner监控window系统各项指标详解
  13. 【LeetCode每天一题】Combinations(组合)
  14. 《Linux内核分析》第五周笔记 扒开系统调用的三层皮(下)
  15. linux下安装svn出现configure: error: We require OpenSSL; try --with-openssl
  16. 用MVC5+EF6+WebApi 做一个小功能(四) 项目分层功能以及文件夹命名
  17. SMTP协议及POP3协议-邮件发送和接收原理(转)
  18. ELK系列四:Logstash的在ELK架构中的使用和简单的输入
  19. maven常用的plugin
  20. 每天一个linux命令:【转载】more命令

热门文章

  1. Android 吸入动画效果详解
  2. HTML5调用摄像头实现拍照功能(兼容各大主流浏览器)
  3. 开发腾讯移动游戏平台SDK Android版Ane扩展 总结
  4. sqlHelper的增删改查
  5. ActiveReports 9 新功能:创新的设计分层报告
  6. VSTO 学习笔记(十)Office 2010 Ribbon开发
  7. selenium让人摸不着头脑的问题
  8. hdu1532(最大流)
  9. Oracle数据库案例整理-Oracle系统执行时故障-Shared Pool内存不足导致数据库响应缓慢
  10. Hibernate实体对象继承策略