90分 #9错误 求助大佬!
查看原帖
90分 #9错误 求助大佬!
1114456
takagi73楼主2024/1/5 12:23
#include <iostream>
using namespace std;
int main() 
{
	int s, v; cin >> s >> v;
	int x = s / v + 1;
	int a = x / 60; int b = x % 60;
	if (x > 7 * 60 + 50)//判断是否会到前一天
	{
		if (b > 50) //分钟大于50 小时-1
		{
			if (30 - a < 10) cout << 0;
			cout << 30 - a << ':';
			cout<<60-(b-50);
		}
		else
		{
			if (31 - a < 10) cout << 0;
			cout << 31 - a << ':';
			if (50-b<10) cout << 0;
			cout<< 50 - b;
		}
	}
	else
	{
		if (b > 50)
		{
			cout << 0 << 6 - a << ':';
			cout<< 60 - (b-50);
		}
		else
		{
			cout << 0 << 7 - a << ':';
			if (50 - b < 10) cout << 0;
			cout << 50 - b;
		}
	}
}
2024/1/5 12:23
加载中...