Problem 1067. The Dark Side of the Die
It is well-known that opposite sides of a classic hexahedral die add to 7. Given a vector of dice rolls, calculate the sum of the hidden face. That is, the sum of the values opposite the rolled value.
For example, if we roll a 2 and then a 6, we calculate that the opposite side of the dice were 5 and 1. Therefore, the answer is 6. This can also be calculated another way: since we know we rolled 2 dice, the total sum of the front and back faces of the dice must be 14 (7x2). If we then subtract the sum of the rolled values (2+6=8) from our total sum, we get the correct final answer (14-8=6)!
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers142
Suggested Problems
-
All your base are belong to us
559 Solvers
-
The Hitchhiker's Guide to MATLAB
3353 Solvers
-
542 Solvers
-
Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
388 Solvers
-
Create a two dimensional zero matrix
508 Solvers
More from this Author56
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!