卡点4,7,八十分求解

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

2901624560fbi @ 2023-12-29 15:54:52

#include<stdio.h>
int main(){
int a,b,d;
scanf("%d %d",&a,&b);
if(a%b==0)
d=a/b;
else 
d=a/b+1;
int f=31,e=50,p;
if(d<=50)
printf("%02d:%02d",f%24,e-d);
if(50<d&&d<60)
printf("%02d:%02d",(f-1)%24,e+60-d);
if(d>=60)
{if(e-d%60<0)
printf("%02d:%02d",(f-d/60+1)%24,e-d%60+60);
else 
printf("%02d:%02d",(f-d/60)%24,e-d%60);}
return 0;}

by 违规用户名971024 @ 2024-01-05 12:38:08

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int s,v;
    cin>>s>>v;
    int t=ceil(1.0*s/v)+10;
    int f=60*(24+8)-t;
    int h=(f/60)%24;
    int m=f%60;
    printf("%02d:%02d",h,m);
    return 0;
}
不用那么麻烦。@ takagi73

|