Codechef Problems: Gambling (GAMBLING)

 Problem Statement: 


Solution: 

Given: A - Number turned up when dice is rolled for first time 
to find: What number should appear on second roll for sum of two number will be 7

this answer is very simple 

A        B
1    -     6
2    -     5
3    -     4
4    -     3
5    -     2
6    -     1

therefore, answer will be (7 - A) 

Code Solution: 

#include <bits/stdc++.h>

using namespace std;

int main() {
    int a;
    cin >> a;

    cout << 7 - a << endl;
    return 0;
}

Comments

Popular posts from this blog

Codechef Problems: Triangles (TRIANGLE7)

Codechef Problems: Assignment Due (P1_175)

Codechef Problems : Happy New Year! (NEWYEAR)