c语言方法求解

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

KateHe @ 2024-03-11 16:08:57


#include<stdio.h>
int main()
{
    int s,v,t,to;
    scanf("%d%d",&s,&v);
    t=s/v+10;
    if (t < 0 || t >= 1440)
        return 1;
    if (10<t<480)
        printf("0%d:%d\n",8-t/60,60-t%60);
    else
        printf("%d:%d\n",32-t/60,60-t%60);

    return 0;
}

by Cheems_MAX @ 2024-03-20 18:21:30

@KateHe
可以用一下这个 ```c

include<bits/stdc++.h>

using namespace std; int main() { int s,v; scanf("%d%d",&s,&v); int t_walk=ceil(1.0s/v)+10; int from_zero=60(24+8)-t_walk; int hh=(from_zero/60)%24; int mm=from_zero%60; printf("%02d:%02d\n",hh,mm); return 0; }



#include<bits/stdc++.h>
using namespace std;  
int main()  
{  
    int s,v;
    scanf("%d%d",&s,&v);  
    int t_walk=ceil(1.0*s/v)+10;    
    int from_zero=60*(24+8)-t_walk;  
    int hh=(from_zero/60)%24;
    int mm=from_zero%60; 
    printf("%02d:%02d\n",hh,mm);
    return 0;
}

|