ghostd0g

Untitled

Feb 4th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.25 KB | None | 0 0
  1.  
  2. import java.util.Scanner;
  3.  
  4. public class TheaThePhotographer {
  5.     public static void main(String[] args) {
  6.         Scanner s = new Scanner(System.in);
  7.  
  8.         int numberOfPictures = Integer.parseInt(s.nextLine());
  9.         int filterTimeSecondsPerPic =Integer.parseInt(s.nextLine());
  10.         int filterFactor=Integer.parseInt(s.nextLine());
  11.         int timeUpploadPerPic=Integer.parseInt(s.nextLine());
  12.  
  13.         double procent=filterFactor/100.0;
  14.         double usefull=Math.ceil(procent*numberOfPictures);
  15.         long fullTime=(long)numberOfPictures*filterTimeSecondsPerPic;
  16.         long fullUpploadTime=(long)usefull*timeUpploadPerPic;
  17.         long totalTime=fullUpploadTime+fullTime;
  18.  
  19.  
  20.         long seconds = (totalTime % 60);
  21.             long minutes = (totalTime / 60);
  22.             long hours = (minutes / 60);
  23.             long days = (hours / 24);
  24.  
  25.  
  26.             if (seconds >= 60)
  27.             {
  28.                 seconds = seconds % 60;
  29.             }
  30.             if (minutes>=60)
  31.             {
  32.                 minutes = minutes % 60;
  33.             }
  34.             if (hours>=24)
  35.             {
  36.                 hours = hours % 24;
  37.             }
  38.  
  39.         System.out.printf("%d:%02d:%02d:%02d",days,hours,minutes,seconds);
  40.  
  41.  
  42.  
  43.  
  44.     }
  45. }
Add Comment
Please, Sign In to add comment