90分,求大佬帮助

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

loose @ 2023-09-22 23:10:26

#include<math.h>
#include<stdio.h>
int main()
{
    double s,v,t,z;
    int i,j,x,y,m;
    scanf("%lf %lf",&s,&v);
    t = s / v;
    j = (int)round(t);
    if(t > j)
    j++ ; 
    z = j + 10;
    t = z / 60.0;
    i = (int)t;
    m = (int)z;
    x = m % 60;
    if(j >= 470 )
    {
        y = 8 + 24 - i - 1;
    }
    else y = 8 - i - 1;

    if(x == 0)
    {
        y++;
    }
    else if(x != 60)
    x = 60  - x;

    if(y > 10 && x > 10)
        printf("%d:%d",y,x);
    else  if(y > 10 && x < 10)
            printf("%d:0%d",y,x);
            else  if(y < 10 && x > 10)
                    printf("0%d:%d",y,x);
                    else printf("0%d:0%d",y,x);
    return 0;
}

by loose @ 2023-09-22 23:40:01

搞清楚了,是因为if判断的语句应该是if(y >= 10 && x >= 10),我少了=号,所以过不去


|