求带佬帮忙看看为什么第十个测试点是Too short on line 1
查看原帖
求带佬帮忙看看为什么第十个测试点是Too short on line 1
386204
KG_hakure楼主2021/8/9 12:46
#include<iostream>
#include<cmath>
using namespace std;
int check(int n)
{
	if(n<10&&n>=0)
			cout<<0<<n;
	else if(n>=10)
			cout<<n;
}
int main()
{
	int t,h;
	float s,v;
	
	cin>>s>>v;
	t = ceil(s/v);
	t = t + 10;
	h = floor(t / 60);
	t = t % 60;	
	
	if(t>0)
		h++;		

	int rest_t,rest_h;
	if(t>0)
		rest_t = 60 - t;
	else
		rest_t = 0;
		
	if(h<=8)
	{
		rest_h = 8 - h;
		cout<<0<<rest_h<<':';
		check(rest_t);
	}
	else if(h>8 && h<=24)
	{
		rest_h = 24 - h + 8;
		if(rest_h>10)
		{
			cout<<rest_h<<':';
			check(rest_t);
		}
		else if(rest_h<10 && rest_h>=8)
		{
			check(rest_h);
			cout<<':';
			check(rest_t);
		}
	}
	else if(h>24)
		cout<<0<<8<<':'<<0<<0;
	return 0;
} 
2021/8/9 12:46
加载中...