fork download
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4. public static void main(String[] args) {
  5. Scanner sc = new Scanner(System.in);
  6. int a = sc.nextInt();
  7. int b = sc.nextInt();
  8. int c = sc.nextInt();
  9. int d = b+c;
  10.  
  11. if(d>=60){
  12. a += (int)d/60;
  13. b = d%60;
  14. if(a>=24){
  15. a -= 24;
  16. }
  17. if(d == 60){
  18. b=0;
  19. a+=1;
  20. }
  21. System.out.println(a+" "+b);
  22. }else {
  23. b=d;
  24. System.out.println(a+" "+b);
  25. }
  26.  
  27. }
  28. }
Success #stdin #stdout 0.15s 58828KB
stdin
0 59
1
stdout
2 0