codeforce 9A
来源:互联网 发布:新少林五祖 知乎 编辑:程序博客网 时间:2024/06/06 02:47
http://vjudge.net/contest/view.action?cid=47681#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
1/2
Hint
Dot will go to Transylvania, if she is lucky to roll 4, 5 or 6 points.
#include <stdio.h>#include <string.h>#include <iostream>using namespace std;int main(){ int m,n; while(~scanf("%d%d",&n,&m)) { if(n<m) swap(n,m); int x=6-n+1; if(x==0) printf("0/1\n"); if(x==1) printf("1/6\n"); if(x==2) printf("1/3\n"); if(x==3) printf("1/2\n"); if(x==4) printf("2/3\n"); if(x==5) printf("5/6\n"); if(x==6) printf("1/1\n"); } return 0;}
- codeforce 9A
- Codeforce A
- Codeforce # A Plug-in
- codeforce 2A Winner
- Contest on codeforce A
- codeforce 11 04 A
- codeforce小水题--A. Presents
- Codeforce #145A Cinema
- codeforce日记 371A
- CodeForce 393A Nineteen
- codeforce 402A - Nuts
- Codeforce A. Milking cows
- codeforce 427A
- codeforce 433A
- codeforce 6A
- codeforce 7A
- codeforce 10A
- codeforce 11 A
- typedef int (init_fnc_t) (void)和typedef int (*init_fnc_t) (void)
- ubuntu下如何安装flash
- 想法于创新
- Objective C Foundation框架(NSString)
- UIApplication代理简介
- codeforce 9A
- 对《C和指针》及《编码:藏匿在计算机软硬件背后的语言》两本书籍的看法
- 最短路算法
- codeforce 9C 找规律的思维题
- Java异常处理终结篇——如何进行Java异常处理设计
- POJ 3680 Intervals
- 十大要避免的Ext JS开发方法
- 设计模式——三大工厂模式
- 【Espruino】NO.09 使用SPI操作Sharp Memory LCD