Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.05 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 ConsoleApp165
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             double m = double.Parse(Console.ReadLine());
  15.  
  16.             double totak = m;
  17.             double sum = 0d;
  18.             double runn = 0d;
  19.  
  20.             for (int i = 0; i < n; i++)
  21.             {
  22.                 int per = int.Parse(Console.ReadLine());
  23.                 totak = totak + totak * per / 100;
  24.                 sum = sum + totak;
  25.             }
  26.             sum = sum + m;
  27.  
  28.             if (sum >= 1000)
  29.             {
  30.                 Console.WriteLine($"You've done a great job running {Math.Ceiling(sum - 1000)} more kilometers!");
  31.             }
  32.             else
  33.             {
  34.                 runn = 1000 - sum;
  35.                 Console.WriteLine($"Sorry Mrs. Ivanova, you need to run {Math.Ceiling(runn)} more kilometers");
  36.             }
  37.  
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement