第 3 个测试点,求助!!!谢谢各位大佬!!

P5707 【深基2.例12】上学迟到

crayn1 @ 2024-10-16 05:09:02

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        int v = sc.nextInt();
        int t = s/v;
        int t1 = t+10;

        if(s%v != 0){
            t1 = t + 10+ 1;
        }

        if(t1<60){
            System.out.println("07:"+(60-t1));
        }

        if(t1 == 60){
            System.out.println("07:00");
        }

        if(t1>60 && t1<480){
            int a = t1/60;
            int b = t1%60;
            int c = 8-a-1;
            int d = 60-b;
            if(d>=10 && d != 60){
                System.out.println("0"+c+":"+d);
            }else if(d<10){
                System.out.println("0"+c+":"+"0"+d);
            }
            if(d == 60){
                System.out.println("0"+(c+1)+":"+"00");
            }
        }

        if(t1 == 480){
            System.out.println("00:00");
        }

        if(t1 > 480){
            int a = t1/60;
            int b = t1%60;
            int d = 60 - b;
            if(a == 8){
                if(d>=10 && d!= 60){
                    System.out.println("23"+":"+d);
                }else{
                    System.out.println("23"+":"+"0"+d);
                }

            }
            if(a>8){
               int x = a-8;
               int y = 24-x-1;

               if(y>=10){
                   if(d>=10 && d!= 60){
                       System.out.println(y+":"+d);
                   }else if(d<10){
                       System.out.println(y+":"+"0"+d);
                   }
                   if(d == 60){
                       System.out.println((y+1)+":"+"00");
                   }
               }

               if(y<10){
                   if(d>=10 && d!= 60){
                       System.out.println("0"+y+":"+d);
                   }else if(d<10){
                       System.out.println("0"+y+":"+"0"+d);
                   }
                   if(d == 60){
                       System.out.println("0"+(y+1)+":"+"00");
                   }
               }
            }
        }
    }
}

|