Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Carnival 1.0
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here List<int> points = new List<int>(new int[]{1,2,3,5,10}); List<List<int>> pointsList = new List<List<int>>(); pointsList.Add(new List<int>(new int[]{1,2,3,5,10})); pointsList.Add(new List<int>(new int[]{1,2,3,5,10})); pointsList.Add(new List<int>(new int[]{1,2,3,5,10})); pointsList.Add(new List<int>(new int[]{1,2,3,5,10})); //int count = 1; List<int> count = new List<int>(new int[]{0,0,0,0}); int result; List<string> title = new List<string>(new string[]{"No Prize", "Small Prize", "Medium Prize", "Large Prize"}); for (int i = 0; i < pointsList[0].Count; i++) { for (int j = 0; j <pointsList[1].Count; j++) { for (int m = 0; m <pointsList[2].Count; m++) { for (int n = 0; n <pointsList[3].Count; n++) { //Console.Write("{0} {1} {2} {3} {4}\n", count, pointsList[0][i], pointsList[1][j], pointsList[2][m], pointsList[3][n]); result = pointsList[0][i] + pointsList[1][j] + pointsList[2][m] + pointsList[3][n]; if (result <8) { //Console.WriteLine("{0} {1} {2} {3}; Score = {4}, count = {5}", pointsList[0][i], pointsList[1][j], pointsList[2][m], pointsList[3][n], result, count); count[0]++; } else if (result >= 8 && result <=18) { //Console.WriteLine("{0} {1} {2} {3}; Score = {4}, count = {5}", pointsList[0][i], pointsList[1][j], pointsList[2][m], pointsList[3][n], result, count); count[1]++; } else if (result >= 19 && result <=25) { //Console.WriteLine("{0} {1} {2} {3}; Score = {4}, count = {5}", pointsList[0][i], pointsList[1][j], pointsList[2][m], pointsList[3][n], result, count); count[2]++; } else if (result >=26) { //Console.WriteLine("{0} {1} {2} {3}; Score = {4}, count = {5}", pointsList[0][i], pointsList[1][j], pointsList[2][m], pointsList[3][n], result, count); count[3]++; } } } } } for (int i = 0; i< count.Count; i++) { Console.WriteLine(title[i] + ": " + count[i] + "; Probability: " + Convert.ToInt32(100*(double)count[i]/625)+"%"); } } } }
run
|
edit
|
history
|
help
0
simpleDelegate
sdfrgthyjujyhtgtg
Lab8
LinqGroupContiguous
Binary search tree - Post-order Traversal
summing a set
first
Chest Interaction Unity
Calculator
remove special char