Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class TheaThePhotographer {
- public static void main(String[] args) {
- Scanner s = new Scanner(System.in);
- int numberOfPictures = Integer.parseInt(s.nextLine());
- int filterTimeSecondsPerPic =Integer.parseInt(s.nextLine());
- int filterFactor=Integer.parseInt(s.nextLine());
- int timeUpploadPerPic=Integer.parseInt(s.nextLine());
- double procent=filterFactor/100.0;
- double usefull=Math.ceil(procent*numberOfPictures);
- long fullTime=(long)numberOfPictures*filterTimeSecondsPerPic;
- long fullUpploadTime=(long)usefull*timeUpploadPerPic;
- long totalTime=fullUpploadTime+fullTime;
- long seconds = (totalTime % 60);
- long minutes = (totalTime / 60);
- long hours = (minutes / 60);
- long days = (hours / 24);
- if (seconds >= 60)
- {
- seconds = seconds % 60;
- }
- if (minutes>=60)
- {
- minutes = minutes % 60;
- }
- if (hours>=24)
- {
- hours = hours % 24;
- }
- System.out.printf("%d:%02d:%02d:%02d",days,hours,minutes,seconds);
- }
- }
Add Comment
Please, Sign In to add comment