Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class _1_VideoDurations {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Scanner scan = new Scanner(System.in);
- String inputLine = scan.nextLine();
- int hours = 0;
- int minutes = 0;
- while (!inputLine.equals("End")) {
- String[] inputs = inputLine.split(":");
- hours += Integer.parseInt(inputs[0]);
- minutes += Integer.parseInt(inputs[1]);
- inputLine = scan.nextLine();
- }
- if (minutes > 59) {
- hours += minutes / 60;
- minutes %= 60;
- }
- System.out.printf("%d:%02d%n", hours, minutes);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement