Codeforces Codeforces Beta Round #9 (Div. 2 Only) A. Die Roll

#include<bits/stdc++.h>

//#include<cstdio>
//#include<iostream>
//#include<algorithm>
//#include<vector>
//#include<cstring>
//#include<cmath>
//#include<map>

using namespace std;

#define fast ios_base::sync_with_stdio(false)
#define bfast cin.tie(0)
#define outs(x) cout << x << " "
#define outn(x) cout << x << "\n"
#define sf scanf
#define pf printf

typedef long long LL;
typedef vector<int>vii;
typedef vector<LL>vll;

void sol(LL n)
{
    if(n == 1) outn("1/6");
    else if(n == 2) outn("1/3");
    else if(n == 3) outn("1/2");
    else if(n == 4) outn("2/3");
    else if(n == 5) outn("5/6");
    else if(n == 6) outn("1/1");
}

int main()
{
    fast;
    LL a, b , val=0;
    while(cin >> a >> b)
    {
        if(a == 0 and b== 0)
        {
            cout << "0/1\n";
        }

        else
        {
            val = max(a , b);
            val = 6 - val + 1; //outn(val);

            if(val > 6 or val <= 0)
            {
                outn("0/1");
                continue;
            }

            sol(val);
        }
    }

    return 0;
}

Comments

Popular posts from this blog

SPOJ-CMG - Collecting Mango

LightOJ 1009 - Back to Underworld

LeetCode Palindrome Number