isahdggd222 @ 2024-10-24 20:26:48
#include "stdio.h"
int main(){
int s,v,minute,hour,t;
scanf("%d %d",&s,&v);
t = s/v;
if((double)s/v>t)
{
t++;
}
minute = 1920;
if(t<=1920)
{
minute -= (t+10);
hour = minute/60;
if(hour>24)
{
hour -= 24;
}
minute %= 60;
if(hour<10)
{
printf("0");
}
printf("%d:",hour);
if(minute<10)
{
printf("0");
}
printf("%d",minute);
}
else
return 0;
}
请大佬们看看咋改
by wuyusheng @ 2024-10-24 20:30:15
@isahdggd222 我的代码
#include<bits/stdc++.h>
using namespace std;
int main()
{
double s,v;
cin>>s>>v;
int m=8*60+24*60;
int t=ceil(s/v)+10;
m=m-t;
if(m>60*24)
m=m-60*24;
int g=m%60;
int h=ceil(m/60);
if(h<10)
{
if(g<10) cout<<"0"<<h<<":0"<<g;
else cout<<"0"<<h<<":"<<g;
}
else
{
if(g<10) cout<<h<<":0"<<g;
else cout<<h<<":"<<g;
}
}
by liyunhe @ 2024-10-24 20:35:04
@isahdggd222
#include<bits/stdc++.h>
using namespace std;
int main(){
int s,v,h,m=0;
cin>>s>>v;
int t=ceil(1.0*s/v)+10;//ceil是上取整
int from_zero=60*32-t;//距离前一天的凌晨
h=(from_zero/60)%24;
m=from_zero%60;
printf("%02d:%02d",h,m);
return 0;
}
代码code
by isahdggd222 @ 2024-10-24 22:06:10
int main(){
int s,v,minute,hour,t;
scanf("%d %d",&s,&v);
t = s/v;
if((double)s/v>t)
{
t++;
}
t += 10;
minute = 8*60+24*60;
minute -= t;
if(minute>=24*60) minute -= 24*60;
hour = minute/60;
minute %= 60;
printf("%02d:%02d",hour,minute);
return 0;
}
```改完了,谢谢大佬们