70分求助 (Java求助)

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

chengyan @ 2023-09-09 09:32:35


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 time=s/v;
        if(s%v!=0){
            time++;
        }
        int garbageTime = 10;
        double totalTime = time + garbageTime;
        int hour = (int) (totalTime / 60);
        int minute = (int) (totalTime % 60);
            hour = 7-hour;
            minute = 60-minute;
        System.out.printf("%02d:%02d",hour,minute);
    }
}

|