Codeforces Beta Round #9 (Div. 2 Only) A. Die Roll 水题
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));
}
Codeforces Beta Round #9 (Div. 2 Only) A. Die Roll 水题的更多相关文章
- Codeforces Beta Round #9 (Div. 2 Only) B. Running Student 水题
B. Running Student 题目连接: http://www.codeforces.com/contest/9/problem/B Description And again a misfo ...
- Codeforces Beta Round #5 A. Chat Server's Outgoing Traffic 水题
A. Chat Server's Outgoing Traffic 题目连接: http://www.codeforces.com/contest/5/problem/A Description Po ...
- Codeforces Beta Round #3 A. Shortest path of the king 水题
A. Shortest path of the king 题目连接: http://www.codeforces.com/contest/3/problem/A Description The kin ...
- Codeforces Beta Round #80 (Div. 2 Only)【ABCD】
Codeforces Beta Round #80 (Div. 2 Only) A Blackjack1 题意 一共52张扑克,A代表1或者11,2-10表示自己的数字,其他都表示10 现在你已经有一 ...
- Codeforces Beta Round #83 (Div. 1 Only)题解【ABCD】
Codeforces Beta Round #83 (Div. 1 Only) A. Dorm Water Supply 题意 给你一个n点m边的图,保证每个点的入度和出度最多为1 如果这个点入度为0 ...
- Codeforces Beta Round #79 (Div. 2 Only)
Codeforces Beta Round #79 (Div. 2 Only) http://codeforces.com/contest/102 A #include<bits/stdc++. ...
- Codeforces Beta Round #77 (Div. 2 Only)
Codeforces Beta Round #77 (Div. 2 Only) http://codeforces.com/contest/96 A #include<bits/stdc++.h ...
- Codeforces Beta Round #76 (Div. 2 Only)
Codeforces Beta Round #76 (Div. 2 Only) http://codeforces.com/contest/94 A #include<bits/stdc++.h ...
- Codeforces Beta Round #75 (Div. 2 Only)
Codeforces Beta Round #75 (Div. 2 Only) http://codeforces.com/contest/92 A #include<iostream> ...
随机推荐
- jsoup抓取网页报错UnsupportedMimeTypeException
今天在用Jsoup爬虫的时候两次遇到下面错误 Exception in thread "main" org.jsoup.UnsupportedMimeTypeException: ...
- django框架<三>
一.ORM操作 1.django orm创建数据库的方法 (1)指定连接pymysql(python3.x),先配置__init__.py import pymysql pymysql.instal ...
- 【bzoj4293】【PA2015】Siano
如题,首先可以考虑相对大小是不变的. 那么先sort,之后每次在线段树上二分即可. #include<bits/stdc++.h> typedef long long ll; using ...
- 《深入理解Java虚拟机》笔记--第四章、虚拟机性能监控与故障处理工具
主要学习并记录在命令行中操作服务器时使用的六大命令工具,可视化工具JConsole和VisualVM在开发过程中熟悉. 一.jps:虚拟机进程状况工具(JVM Process Status Tool) ...
- MYSQL三种安装方式--rpm包安装
1. 首先检查机器里是否已经存在MySQL $ rpm -qa | grep mysql 2. 去官网下载相应的rpm包:https://dev.mysql.com/downloads/mysql/ ...
- mysql cursor游标的使用,实例
mysql被oracle收购后,从mysql-5.5开始,将InnoDB作为默认存储引擎,是一次比较重大的突破.InnoDB作为支持事务的存储引擎,拥有相关的RDBMS特性:包括ACID事务支持,数据 ...
- springcloud 显示服务详细健康信息
pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="htt ...
- MySQL增删改数据
1.增加数据 ,); /*插入所有字段.一定依次按顺序插入--字符串与日期需要加单引号,数字不需要,各个字段之间用逗号分隔*//*注意不能少或者多字段值*/ ,) /*按字段名插入数据,中间用逗号隔开 ...
- Linux文件系统的详解
这里以 EXT2 文件系统为例 在Linux下,一个磁盘的最前面是MBR,大小为512Byte 在每一个分区下,第一部分是boot sector,接下来是super block,再接下来是inode, ...
- ubuntu 系统提示升级失败,boot空间不足
系统提示升级失败,boot空间不足,解决方法: linux 随着系统的升级,会自动攒下好几个内核 执行 uname -a 看下自己当前启动的是哪个内核 dpkg --get-selections |g ...