3和5错了,求助
查看原帖
3和5错了,求助
244502
_Stay_楼主2021/10/10 10:49
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int h=7,f=50,s,v;
	cin>>s>>v; 
	while(s>v)
	{
		s-=v;
		f--;
		if(f==-1)
		{
			f=59;
			h--;
		}
		if(h==-1)
		{
			h=23;
		}
	}
	if(s>0) f--;
	if(f == -1)
	{
		f=59;
		h--;
	}
	if(h==-1)
	{
		h=23;
	}
	if(h<10 and f<10)
	{
		cout<<0<<h<<":"<<0<<s;
		return 0;
	}
	else if(h<10 and f>=10) 
	{
		cout<<0<<h<<":"<<f;
		return 0;
	}
	else if(h>=10 and f<10)
	{
		cout<<h<<":0"<<f;
		return 0;
	}
	cout<<h<<":"<<f;
	return 0;
 }

2021/10/10 10:49
加载中...