Dark_Monarch @ 2023-11-19 16:47:17
0分求教
by ljcnoi @ 2023-11-19 17:11:06
建议讨论好各种情况,认真审题
#include<bits/stdc++.h>
using namespace std;
int main()
{
int m=10;
int s,v;
cin>>s>>v;
double sv=ceil(s*1.0/v);
m=m+sv;
int h=m/60;
m=m%60;
int tim=0,tih=8;
tim=tim-m;
if(tim<0)
{
tim=tim+60;
tih--;
}
tih=tih-h;
if(tih<0)
{
tih=tih+24;
}
if(tih<10)
{
cout<<0<<tih;
}
else
{
cout<<tih;
}
cout<<":";
if(tim<10)
{
cout<<0<<tim;
}
else
{
cout<<tim;
}
return 0;
}
by Dark_Monarch @ 2023-12-03 14:30:48
@ljcnoi 已经AC了
by Dark_Monarch @ 2023-12-03 15:22:55
#include<bits/stdc++.h>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
int s,v;
scanf("%d%d",&s,&v);
int t_min = ceil(1.0 * s / v) + 10; //向上取整, 分钟为单位
int time_sum = 60 * (24 + 8); //时间限制
int ans = time_sum - t_min;//从0点算,何时出发
int h = (ans / 60) % 24;
int min = ans % 60;
printf("%02d:%02d",h,min);
return 0;
}
@ljcnoi 这样更方便