10分 救

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

czh1 @ 2023-11-07 13:05:59

#include<stdio.h>
int main(){
    int s,v,H=7,M=60,h,m;
    scanf("%d %d",&s,&v);
    double t1=s/v*1.0;
    int t=s/v;
    if(t1!=t){
        t++;
    }
    if(t>50){
        int z=(t-50)/60;
        m=(t-50)%60,h=1+z;
    }else{
        m=t,h=0;
        M=50;
    }
    if(h>7){
        h-=7,H=24;
    }
    printf("%.2d:%.2d",H-h,M-m);
    return 0;
}

by small_lemon_qwq @ 2023-11-07 13:40:18

#include<bits/stdc++.h>
using namespace std;
int s,v,t; 
int main(){
    cin>>s>>v;
    t=ceil(s*1.0/v)+10;
    t=32*60-t;
    if(t<=24*60){
        printf("%.2d:%.2d",t/60,t%60);
    }else{
        printf("%.2d:%.2d",t/60-24,t%60);
    }
    return 0;
}

|