Advertisement
Spocoman

01. SoftUni Reception

Nov 8th, 2023
580
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. using System;
  2.  
  3. namespace SoftUniReception
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int first = int.Parse(Console.ReadLine());
  10.             int second = int.Parse(Console.ReadLine());
  11.             int third = int.Parse(Console.ReadLine());
  12.             int students = int.Parse(Console.ReadLine());
  13.             int counter = 1, hours = 0;
  14.  
  15.             while (students > 0)
  16.             {
  17.                 students -= first + second + third;
  18.                 hours += counter % 3 == 0 && students > 0 ? 2 : 1;
  19.                 counter += 1;
  20.             }
  21.  
  22.             Console.WriteLine($"Time needed: {hours}h.\n");
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement