50分求助
查看原帖
50分求助
1406308
untiy楼主2024/7/25 19:38
#include <bits/stdc++.h>
using namespace std;
int s,v,time_l=8,time_r=0;
int jinzhi(int a,int b)
{
	if(a%b==0) return a/b;
	if(a%b!=0) return a/b+1;
}
int main()
{
	cin>>s>>v;
	int t=jinzhi(s,v)+10;//总共要几分钟 
	//cout<<t<<"\n";
	if(time_r-t<0)
	{
		if(t%60==0) //如果时间为60的倍数 
		{//没必要动分钟 
			if(t<60) time_l-=1;
			else time_l-=t/60;
		}
		if(t%60!=0)//如果不为60的倍数 
		{
			if(t<60) time_l-=1;
			else time_l-=t/60+1;//小时 
			time_r=60;
			time_r-=t%60;//分钟 
		}
	}
	if(time_l<10) cout<<0;
	cout<<time_l<<":"<<time_r;
	return 0;
}
2024/7/25 19:38
加载中...