Advertisement
IvetValcheva

6. Oscars

Mar 28th, 2023
701
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.72 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _6._Oscars
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             //1. Четем от конзолата:
  10.             // => име на актьор/актриса
  11.             string actorName = Console.ReadLine();
  12.             // => първоначален брой точки
  13.             double points = double.Parse(Console.ReadLine());
  14.             // => брой оценяващи
  15.             int n = int.Parse(Console.ReadLine());
  16.  
  17.             string assessorName;
  18.             double assessorPoints;
  19.  
  20.             //2. Създаваме цикъл, който да се изп. за всеки оценяващ
  21.             for (int assessor = 1; assessor <=n; assessor++)
  22.             {
  23.                 // => четем име на оценяващия
  24.                 assessorName = Console.ReadLine();
  25.                 // => четем точки от оценяващия
  26.                 assessorPoints = double.Parse(Console.ReadLine());
  27.  
  28.                 // => към точките до момента добавяме:
  29.                 points = points + assessorName.Length * assessorPoints / 2;
  30.                 //points += assessorName.Length * assessorPoints / 2;
  31.  
  32.                 if (points >= 1250.5)
  33.                 {
  34.                     Console.WriteLine($"Congratulations, {actorName} got a nominee for leading role with {points:f1}!");
  35.                     break;
  36.                 }
  37.             }
  38.  
  39.             //3. Проверяваме дали точките са <1250.5
  40.             if (points < 1250.5)
  41.             {
  42.                 Console.WriteLine($"Sorry, {actorName} you need {1250.5-points:f1} more!");
  43.             }
  44.         }
  45.     }
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement