fbinnzhivko

02.00 Поспаливата котка Том

Apr 25th, 2016
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. using System;
  2. class Program
  3. {
  4.     static void Main()
  5.     {
  6.         decimal input = decimal.Parse(Console.ReadLine());
  7.  
  8.         decimal restDays = input * 127;
  9.         decimal workingDays = (365 - input) * 63;
  10.         decimal totalDays = restDays + workingDays;
  11.  
  12.         if (30000 >= totalDays)
  13.         {
  14.             decimal days = Math.Floor((30000 - totalDays) / 60);
  15.             decimal hours = (30000 - totalDays) % 60;
  16.  
  17.             Console.WriteLine("Tom sleeps well \n{0:f0} hours and {1} minutes less for play", days, hours);
  18.         }
  19.         else
  20.         {
  21.             decimal days = Math.Floor((totalDays - 30000) / 60);
  22.             decimal chasove = (totalDays - 30000) % 60;
  23.  
  24.             Console.WriteLine("Tom will run away \n{0:f0} hours and {1} minutes more for play", days, chasove);
  25.         }
  26.     }
  27. }
Add Comment
Please, Sign In to add comment