Advertisement
Rayk

Untitled

Mar 1st, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. import java.io.BufferedReader;
  2. import java.io.IOException;
  3. import java.io.InputStreamReader;
  4. import java.math.BigInteger;
  5. import java.text.ParseException;
  6.  
  7. public class Sin {
  8. public static void main(String[] args) throws IOException, ParseException {
  9. BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  10.  
  11. String[] data = reader.readLine().split(":");
  12. int hour = Integer.parseInt(data[0]);
  13. int minutes = Integer.parseInt(data[1]);
  14. int seconds = Integer.parseInt(data[2]);
  15.  
  16. int totalSeconds = hour * 60 * 60 + minutes * 60 + seconds;
  17.  
  18. int steps = Integer.parseInt(reader.readLine());
  19. int secondsPerStep = Integer.parseInt(reader.readLine());
  20.  
  21. BigInteger result = new BigInteger(String.valueOf(totalSeconds));
  22. BigInteger secondsForSteps = new BigInteger(String.valueOf(steps)).multiply(BigInteger.valueOf(secondsPerStep));
  23.  
  24. result = result.add(secondsForSteps).mod(BigInteger.valueOf(86400));
  25. BigInteger outputHours = result.divide(BigInteger.valueOf(3600));
  26. result = result.subtract(outputHours.multiply(BigInteger.valueOf(3600)));
  27. BigInteger outputminutes = result.divide(BigInteger.valueOf(60));
  28. result = result.subtract(outputminutes.multiply(BigInteger.valueOf(60)));
  29.  
  30. System.out.printf("Time Arrival: %02d:%02d:%02d", outputHours, outputminutes, result);
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement