Advertisement
sayed393

Untitled

Jan 23rd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.67 KB | None | 0 0
  1. #define ONLINE_JUDGE
  2. using System;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Text;
  6.  
  7. namespace Basic_Syntax
  8. {
  9.     class DCP4Great____The_Work_Is_Done
  10.     {
  11.         public static void Main()
  12.         {
  13.             string line;
  14.             while ((line = Console.ReadLine()) != null)
  15.             {
  16.                 var first = line.Split(' ');
  17.                 var totalHour = Convert.ToInt32(first[0]);
  18.                 var totalEmployee = Convert.ToInt32(first[1]);
  19.                 double[] workHour = new double[totalEmployee];
  20.  
  21.                 for (int i = 0; i < totalEmployee; i++)
  22.                 {
  23.                     workHour[i] = Convert.ToInt32(Console.ReadLine());
  24.                 }
  25.                 var totalWorkhourInaSingleDay = 0.0;
  26.                 for (int i = 0; i < totalEmployee; i++)
  27.                 {
  28.                     totalWorkhourInaSingleDay += workHour[i];
  29.  
  30.                 }
  31.  
  32.                 double result = (double)(totalHour / totalWorkhourInaSingleDay);
  33.                 if (result <= 1)
  34.                 {
  35.                     Console.WriteLine("Project will finish within 1 day.");
  36.                 }
  37.                 else
  38.                 {
  39.                     double resultDecimal = result - Math.Floor(result);
  40.                     if (resultDecimal > 0)
  41.                     {
  42.                         Console.WriteLine($"Project will finish within {(int)result + 1} days.");
  43.                     }
  44.                     else
  45.                     {
  46.                         Console.WriteLine($"Project will finish within {(int)result} days.");
  47.                     }
  48.  
  49.  
  50.                 }
  51.  
  52.             }
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement