Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.math.BigInteger;
- import java.text.ParseException;
- public class Sin {
- public static void main(String[] args) throws IOException, ParseException {
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- String[] data = reader.readLine().split(":");
- int hour = Integer.parseInt(data[0]);
- int minutes = Integer.parseInt(data[1]);
- int seconds = Integer.parseInt(data[2]);
- int totalSeconds = hour * 60 * 60 + minutes * 60 + seconds;
- int steps = Integer.parseInt(reader.readLine());
- int secondsPerStep = Integer.parseInt(reader.readLine());
- BigInteger result = new BigInteger(String.valueOf(totalSeconds));
- BigInteger secondsForSteps = new BigInteger(String.valueOf(steps)).multiply(BigInteger.valueOf(secondsPerStep));
- result = result.add(secondsForSteps).mod(BigInteger.valueOf(86400));
- BigInteger outputHours = result.divide(BigInteger.valueOf(3600));
- result = result.subtract(outputHours.multiply(BigInteger.valueOf(3600)));
- BigInteger outputminutes = result.divide(BigInteger.valueOf(60));
- result = result.subtract(outputminutes.multiply(BigInteger.valueOf(60)));
- System.out.printf("Time Arrival: %02d:%02d:%02d", outputHours, outputminutes, result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement