Advertisement
MartinYanchev-99

23 July Loss energy

Aug 30th, 2017
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.69 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace energyLoss
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double trainingDays = double.Parse(Console.ReadLine());
  14.             double numberOfDancers = double.Parse(Console.ReadLine());
  15.             double allEnergyOfDancers = 100 * trainingDays * numberOfDancers;
  16.             double lossEnergy = 0;
  17.             for (int i = 1; i <= trainingDays; i++)
  18.             {
  19.                 double trainingHours = double.Parse(Console.ReadLine());
  20.                 if (i%2==0 && trainingHours%2==0 )
  21.                 {
  22.                     lossEnergy += 10 * 68;
  23.                 }
  24.                 else if (i%2!=0 && trainingHours%2!=0)
  25.                 {
  26.                     lossEnergy += 10 * 30;
  27.                 }
  28.                 else if (i%2==0 && trainingHours%2!=0)
  29.                 {
  30.                     lossEnergy += 10 * 65;
  31.                 }
  32.                 else if (i%2!=0 && trainingHours%2==0)
  33.                 {
  34.                     lossEnergy += 10 * 49;
  35.                 }
  36.  
  37.             }
  38.             double remainEnergy = allEnergyOfDancers - lossEnergy;
  39.             double remainEnergyForDayPerDancer = remainEnergy / numberOfDancers / trainingDays;
  40.             if (lossEnergy <= allEnergyOfDancers/2)
  41.             {
  42.                 Console.WriteLine($"They feel good! Energy left: {remainEnergyForDayPerDancer:f2}");
  43.             }
  44.             else
  45.             {
  46.                 Console.WriteLine($"They are wasted! Energy left: {remainEnergyForDayPerDancer:f2}");
  47.             }
  48.            
  49.  
  50.         }
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement