Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace КоледнаШапка
- {
- class Program
- {
- static void Main(string[] args)
- {
- var gameTurns = int.Parse(Console.ReadLine());
- double points = 0;
- double first = 0;
- double second = 0;
- double third = 0;
- double fourth = 0;
- double fifth = 0;
- double inval = 0;
- for (int i = 0; i <= gameTurns; i++)
- {
- double turns = double.Parse(Console.ReadLine());
- if (turns < 0 || 50 < turns)
- {
- inval++;
- points /= 2.0;
- }
- else if (turns < 10)
- {
- first++;
- points = points + turns * 0.20;}
- else if (turns < 20)
- {
- second++;
- points = points + turns * 0.30;
- }
- else if (turns < 30)
- {
- third++;
- points = points + turns * 0.40;
- }
- else if (turns < 40)
- {
- fourth++;
- points = points + 50;
- }
- else if (turns <= 50)
- {
- fifth++;
- points = points + 100;
- }
- if (i == gameTurns -1)
- break;
- }
- Console.WriteLine($"{points:f2}");
- first = first / gameTurns * 100;
- second = second / gameTurns * 100;
- third = third / gameTurns * 100;
- fourth = fourth / gameTurns * 100;
- fifth = fifth / gameTurns * 100;
- inval = inval / gameTurns * 100;
- Console.WriteLine($"From 0 to 9: {first:f2}%");
- Console.WriteLine($"From 10 to 19: {second:f2}%");
- Console.WriteLine($"From 20 to 29: {third:f2}%");
- Console.WriteLine($"From 30 to 39: {fourth:f2}%");
- Console.WriteLine($"From 40 to 50: {fifth:f2}%");
- Console.WriteLine($"Invalid numbers: {inval:f2}%");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment