Gezellig7 @ 2023-12-15 09:02:54
#include <stdio.h>
int round_off(double n){
if(n==int(n)) return (int)n;
else return int(n)+1;
}
int main(){
double s,v;
scanf("%lf %lf",&s,&v);
int time,h,m;
time=round_off(s/v)+10;
if((float)time/60<=8)
{
if(time/60==0){
h=7;m=60-time;
}else{
h=7-time/60;
m=60-time%60;
}
}
else if((float)time/60<=12)
{
time=time-8*60;
if(time/60==0){
h=23;m=60-time;
}else{
h=23-time/60;
m=60-time%60;
}
}
else{
h=8;m=1;
}
printf("%02d:%02d",h,m);
return 0;
}
by 冰糖鸽子 @ 2023-12-15 09:07:46
@Gezellig7
#include <stdio.h>
int round_off(double n){
if(n==int(n)) return (int)n;
else return int(n)+1;
}
int main(){
double s,v;
scanf("%lf %lf",&s,&v);
int time,h,m;
time=round_off(s/v)+10;
if((float)time/60<=8)
{
if(time/60==0){
h=7;m=60-time;
}else{
h=7-time/60;
m=60-time%60;
}
}
else //if((float)time/60<=12) 这种情况不止适用于 12 个小时以内
{
time=time-8*60;
if(time/60==0){
h=23;m=60-time;
}else{
h=23-time/60;
m=60-time%60;
}
}
// else{
// h=8;m=1;
// }
printf("%02d:%02d",h,m);
return 0;
}
by Gezellig7 @ 2023-12-15 09:10:15
@冰糖鸽子 谢谢谢谢解决了!想成了一天12小时QAQ