Advertisement
beinsaduno

02. Sleepy Tom Cat

Mar 15th, 2021
504
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 Sleepy_Tom_Cat
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int dayForRest = int.Parse(Console.ReadLine());
  10.             int alltimeGamesEver = 30000;
  11.             int afterWorkGames = 63;
  12.             int restGames = 127;
  13.             int allYearsDays = 365;
  14.             int gamesInRestDays = dayForRest * restGames;
  15.             int gamesInWorkingDays = (allYearsDays - dayForRest) * afterWorkGames;
  16.             int totalTime = gamesInRestDays + gamesInWorkingDays;
  17.             int games = Math.Abs(alltimeGamesEver - totalTime);
  18.             double hours = games / 60;
  19.             double minutes = games % 60;
  20.  
  21.             if (totalTime > alltimeGamesEver)
  22.             {
  23.                 Console.WriteLine("Tom will run away");
  24.                 Console.WriteLine($" {hours} hours and {minutes} minutes more for play");
  25.             }
  26.             else if (totalTime < alltimeGamesEver)
  27.             {
  28.                 Console.WriteLine("Tom sleeps well");
  29.                 Console.WriteLine($"{hours} hours and {minutes} minutes less for play");
  30.             }
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement