蒟蒻求助
查看原帖
蒟蒻求助
379113
dtrthg楼主2021/9/11 10:57

本蒟蒻贼粗心,大佬轻喷

#include <bits/stdc++.h>
using namespace std;
int h=7,m=50;
int main()
{
	int s,v;cin>>s>>v;
	while(v<=s)
	{
		s-=v;
		m--;
		if(m<0)
		{
			m=59;
			h--;
		}
		if(h<0)
		{
			h=23;
			m=59;
		}
	}
	if(s>0)
	{
		m--;
		if(m<0)
		{
			m=59;
			h--;
		}
		if(h<0)
		{
			h=23;
			m=59;
		}
	}
	if(h<10)
	{
		if(m<10) cout<<'0'<<h<<':'<<'0'<<m<<endl;
		else cout<<'0'<<h<<':'<<m<<endl;
	}
	if(m<10&&h>=10) cout<<h<<':'<<'0'<<m<<endl;
	return 0;
}
2021/9/11 10:57
加载中...