gdfz02sjy @ 2024-03-13 14:51:44
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d;
int h,m;
int main(){
cin>>a>>b;
h=8;
m=0;
c=a/b;
if(a%b!=0)c++;
c+=10;
m-=c;
for(int i=0;i==i;i++){
if(m<0){
m+=60;
h--;
}
else break;
}
cout<<"0"<<h<<":";
if(m<10)cout<<"0"<<m;
else cout<<m;
return 0;
}
不知道错哪了TnT
by 杜都督 @ 2024-03-13 15:08:41
h--;
-> h = (h - 1 + 24) % 24;
cout<<"0"<<h<<":";
-> printf("%02d:", h);
@gdfz02sjy 因为你没考虑前一天出发的情况
by return0114514 @ 2024-03-13 16:10:55
#include<bits/stdc++.h>
using namespace std;
double s,v,m;
int n,a,t,b;
int main()
{
cin>>s>>v;
n=8*60+24*60;
t=ceil(s/v)+10;
n=n-t;
if(n>=24*60) n-=24*60;
b=n%60;
a=n/60;
if(a<10)
{
if(b<10)
{
cout<<"0"<<a<<":0"<<b<<endl;
}
else
{
cout<<"0"<<a<<":"<<b<<endl;
}
}
else
{
if(b<10)
{
cout<<a<<":0"<<b<<endl;
}
else
{
cout<<a<<":"<<b<<endl;
}
}
return 0;
}
by gdfz02sjy @ 2024-03-14 15:28:46
@return0114514 @杜都督 知道了,谢谢