90分,求助

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

Chenqiyu @ 2024-11-06 06:16:09

#include<stdio.h>
int main(){
    int s,v;
    int t,h;
    scanf("%d %d",&s,&v);
    t=(s-1)/v+11;
    if (t<=60&&t>=50){

        printf("07:0%d",60-t);}
    if (t<=50&&t>0){
        printf("07:%d",60-t);}
    if (t>60){
        h=t/60;
        t%=60;
        if (h<=7){
           if (t<=60&&t>=50){
           printf("0%d:0%d",7-h,60-t);}
           if (t<=50&&t>0){
           printf("0%d:%d",7-h,60-t);}}
        if (h>7&&h<=17) {
           if (t<=60&&t>=50){
           printf("%d:0%d",31-h,60-t);}
           if (t<=50&&t>0){
           printf("%d:%d",31-h,60-t);}} 
        if (h>=17) {
           if (t<=60&&t>=50){
           printf("0%d:0%d",31-h,60-t);}
           if (t<=50&&t>0){
           printf("0%d:%d",31-h,60-t);}}       
        }
    return 0;   

}

by c22j33c43 @ 2024-11-06 08:11:43

if(t<=60&&t>=50)中t>=50应为t>50


by c22j33c43 @ 2024-11-06 08:12:13

60-50=10


|