Advertisement
Guest User

Untitled

a guest
Feb 16th, 2022
787
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 KB | None | 0 0
  1. using System;
  2.  
  3. namespace МЕ01._SoftUni_Reception
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int numOfStudentPer1hour1 = int.Parse(Console.ReadLine());
  10.             int numOfStudentPer1hour2 = int.Parse(Console.ReadLine());
  11.             int numOfStudentPer1hour3 = int.Parse(Console.ReadLine());
  12.             int studenCount = int.Parse(Console.ReadLine());
  13.  
  14.             int houerCount = 0;
  15.             int maxStudenForHouer = numOfStudentPer1hour1 + numOfStudentPer1hour2 + numOfStudentPer1hour3;
  16.  
  17.  
  18.             if (studenCount%maxStudenForHouer==0)
  19.             {
  20.                 houerCount = studenCount / maxStudenForHouer;
  21.             }
  22.             else if (studenCount % maxStudenForHouer != 0)
  23.             {
  24.                 houerCount = studenCount / maxStudenForHouer + 1;
  25.             }
  26.  
  27.             if (houerCount>3 && houerCount % 3 == 0)
  28.             {
  29.                 houerCount += houerCount / 3 - 1;
  30.             }
  31.             else if (houerCount>3)
  32.             {
  33.              houerCount += houerCount / 3;
  34.             }
  35.  
  36.             Console.WriteLine($"Time needed: {houerCount}h.");
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement