ivan_gy6ev

Untitled

Jun 3rd, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.29 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _19.TheaThePhotographer
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int totalPictures = int.Parse(Console.ReadLine());
  14.             int filterTimePerPicture = int.Parse(Console.ReadLine());
  15.             int factorFilteringPercentage = int.Parse(Console.ReadLine());
  16.             int amountOfTimePerPicture = int.Parse(Console.ReadLine());
  17.             //time for filtering
  18.             decimal totalTime = (decimal)totalPictures * filterTimePerPicture;
  19.                 //Console.WriteLine(totalTime);
  20.            //time for uploading good pictures
  21.             decimal goodPictures = Math.Ceiling(factorFilteringPercentage*totalPictures/100m);
  22.                 //Console.WriteLine("goodPictures={0}",goodPictures);
  23.             // time for uploading
  24.             decimal timePerUploading = goodPictures*amountOfTimePerPicture;
  25.                 //Console.WriteLine(timePerUploading);
  26.             //output the data:
  27.             totalTime = totalTime + timePerUploading;
  28.                 //Console.WriteLine(totalTime); //total time in seconds
  29.             //days
  30.             decimal totalDays = Math.Floor(totalTime/(60*60*24m));
  31.                 //Console.WriteLine("days:{0}", totalDays);
  32.             //hours
  33.             decimal totalHours = Math.Floor(totalTime/3600m);
  34.                 //Console.WriteLine("hours:{0}", totalHours);
  35.             //minutes
  36.             decimal totalMinutes = Math.Floor((totalTime % 3600m)/60);
  37.                 //Console.WriteLine("minutes:{0}", totalMinutes);
  38.             //seconds
  39.             decimal totalSeconds = ((totalTime % 3600m)/60);
  40.             totalSeconds = Math.Round(Math.Abs(totalMinutes - totalSeconds)*60);
  41.                 //Console.WriteLine("seconds:{0}", totalSeconds);
  42.             //output format data
  43.             string days =Convert.ToString(totalDays);
  44.             string hours = Convert.ToString(totalHours);
  45.             string minutes =Convert.ToString(totalMinutes);
  46.             string seconds = Convert.ToString(totalSeconds);
  47.             Console.WriteLine("{0}:{1:00}:{2:00}:{3:00}",
  48.                 totalDays, totalHours, totalMinutes, totalSeconds);
  49.         }
  50.     }
  51. }
Add Comment
Please, Sign In to add comment