Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace tESt
- {
- class Program
- {
- static void Main(string[] args)
- {
- double daysOff = double.Parse(Console.ReadLine());
- const double neceserySleepMin = 30000;
- const double workingDaysMinutes = 63;
- const double offDaysMinutess = 127;
- const double yearDays = 365;
- var workingDays = yearDays - daysOff;
- var playTime = (workingDays * workingDaysMinutes) + (daysOff * offDaysMinutess);
- var finalTime = neceserySleepMin - playTime;
- double hours = finalTime / 60;
- double minutes = finalTime % 60;
- if (finalTime > 0)
- {
- hours = Math.Floor(hours);
- minutes = Math.Floor(minutes);
- if (minutes < 2)
- {
- Console.WriteLine("Tom sleeps well");
- Console.WriteLine($"{hours} hours and {minutes} minute less for play");
- }
- else if ( hours < 2)
- {
- Console.WriteLine("Tom sleeps well");
- Console.WriteLine($"{hours} hour and {minutes} minutes less for play");
- }
- else if ( hours > 2)
- {
- Console.WriteLine("Tom sleeps well");
- Console.WriteLine($"{hours} hours and {minutes} minutes less for play");
- }
- else
- {
- Console.WriteLine("Tom sleeps well");
- Console.WriteLine($"{hours} hours and {minutes} minutes less for play");
- }
- }
- else if (finalTime < 0)
- {
- hours = Math.Ceiling(hours);
- minutes = Math.Ceiling(minutes);
- Console.WriteLine("Tom will run away");
- Console.WriteLine($"{Math.Abs(hours)} hours and {Math.Abs(minutes)} minutes more for play") ;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment