Advertisement
Guest User

Untitled

a guest
Sep 24th, 2016
509
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.10 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.Thea_The_Photographer
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int picturesTaken = int.Parse(Console.ReadLine());
  14.             int filterTimePerPicture = int.Parse(Console.ReadLine());
  15.             int percentage = int.Parse(Console.ReadLine());
  16.             int uploadTimePerPicture = int.Parse(Console.ReadLine());
  17.             if ((picturesTaken >= 0 && picturesTaken <= 1000000) &&
  18.                (filterTimePerPicture >= 0 && filterTimePerPicture <= 100000) &&
  19.                (percentage >= 0 && percentage <= 100) &&
  20.                (uploadTimePerPicture >= 0 && uploadTimePerPicture <= 100000))
  21.             {
  22.  
  23.                 int timeToFilterInSeconds = picturesTaken * filterTimePerPicture;
  24.                 double totalPictures = Math.Ceiling((picturesTaken * (percentage * 0.01)));
  25.                 int TimeToUpload = (int)totalPictures * uploadTimePerPicture + timeToFilterInSeconds;
  26.  
  27.                 TimeSpan time = TimeSpan.FromSeconds(TimeToUpload);
  28.                 string totalTime = time.ToString(@"d\:hh\:mm\:ss");
  29.                 Console.WriteLine(totalTime);
  30.             }
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement