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