Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.lang.reflect.Array;
- import java.util.*;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
- import java.util.stream.Collectors;
- public class Main {
- public static void main(String[] args) throws IOException {
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- Scanner scanner = new Scanner(System.in);
- int hours = Integer.parseInt(scanner.nextLine());
- int minutes = Integer.parseInt(scanner.nextLine());
- int allminutes = hours*60 + minutes + 30;
- int newHours = allminutes/60;
- int newMinutes = allminutes%60;
- if (newHours > 23){
- newHours%=24;
- if (newMinutes <10){
- System.out.printf("%d:0%d",newHours, newMinutes);
- }else {
- System.out.printf("%d:%d",newHours, newMinutes);
- }
- }else if (newHours<10){
- /// Принтираш повече от веднъж при вход 0 и 30 принтира два пъри два различни входа защото правеше проверката за минутите дали са по-малко от 10 чак след като беше принтирал веднъж резултат ///
- if ( newMinutes < 10 ){
- System.out.printf("%d:0%d", newHours, newMinutes);
- }else {
- System.out.printf("%d:%d", newHours, newMinutes);
- }
- }else {
- if (newMinutes < 10) {
- System.out.printf("%d:0%d", newHours, newMinutes);
- }else {
- System.out.printf("%d:%d", newHours, newMinutes);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement