Skip to content

Instantly share code, notes, and snippets.

@scilganon
Created December 7, 2018 15:40
Show Gist options
  • Save scilganon/872756eb5271c25e2783c663d98c008e to your computer and use it in GitHub Desktop.
Save scilganon/872756eb5271c25e2783c663d98c008e to your computer and use it in GitHub Desktop.
Бросают два кубика. С какой вероятностью сумма чисел на них будет больше или равна 8?
let dataSet = new Set();
for(let i=1; i<=6; i++){
for(let j=1; j<=6; j++){
if(i+j>=8){
dataSet.add([i,j]);
}
}
}
console.log(`Size: ${dataSet.size}`);
dataSet.forEach(([i, j]) => console.log(`i(${i})/j(${j})`));
// 15(dataSet.size) / 36 (6 * 6 sides) = 0.42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment