Wwl041125 @ 2023-09-27 00:30:01
#include<iostream>
using namespace std;
int main()
{
int s,v;
cin>>s >>v;
int t1;
t1=s/v;
if(s%v!=0)
{
t1+=1;
}
int t2;
t2=t1+10;
if(t2<=1400)
{
if(t2<=480)
{
int tn1=480-t2;
int h1,m1;
h1=tn1/60;
m1=tn1%60;
if(tn1%60==0)
{
m1=0;
}
if(m1<10)
{
cout<<"0"<<h1<<":"<<"0"<<m1;
}
else
{
cout<<"0"<<h1<<":"<<m1;
}
}
else
{
int tn2;
tn2=t2-480;
int h2,m2;
h2=23-(tn2/60);
m2=60-(tn2%60);
if(tn2%60==0)
{
m2=0;
}
if(tn2>780)
{
if(tn2%60<10)
{
cout<<"0"<<h2<<":"<<"0"<<m2;
}
else
{
cout<<"0"<<h2<<":"<<m2;
}
}
else if(tn2%60>=10)
{
cout<<h2<<":"<<m2;
}
else
{
cout<<h2<<":"<<"0"<<m2;
}
}
}
return 0;
};
by JoanneLi @ 2023-10-03 21:21:53
上代码(你这个太复杂了吧!看不懂)
#include<bits/stdc++.h>
using namespace std;
int main(){
int s,v,HH=7,MM=50,t;
cin>>s>>v;
t=s/v;
if(s%v!=0)t++;
if(470>=t){
HH-=t/60;
if(t%60>MM){
HH--;
MM+=60-t%60;
}else{
MM-=t%60;
}
}else{
HH+=24;
HH-=t/60;
if(t%60>MM){
HH--;
MM+=60-t%60;
}else{
MM-=t%60;
}
}
if(HH<10)cout<<'0';
cout<<HH<<':';
if(MM<10)cout<<'0';
cout<<MM;
}
by Wwl041125 @ 2023-10-07 22:02:48
@JoanneLi 好的,感谢! 我的问题也找到了。