Official algorithmic problem description and constraints.
Despite everyone's advice, Chef has decided to gamble away his money.
Today he chose a dice game to bet on. Chef will roll 2
2 die one after the other, and Chef wins if and only if the sum of the 2
2 dice rolls is exactly 7
7.
The die are standard fair 6
6-faced, with numbers 1
1 through 6
6 written on the sides.
Chef's first roll turned up to be the number A
A. What number does Chef need on his second roll to win the game? It can be proven that this number exists and is unique.
Output the required dice roll on the 2nd
2nd
dice for Chef to win the game.
Input
Output
1 6
Chef got a 1
1 on his first roll, so he needs 7−1=6
7−1=6 on his second roll.
Did you like the problem statement?
34 users found this helpful
More Info
Time limit1 secs
Memory limit1.5 GB
Source Limit50000 Bytes
Detailed video explanations, mathematical intuition, and clean C++ implementation code.