麻烦请问我这有什么问题,有两个过不了
查看原帖
麻烦请问我这有什么问题,有两个过不了
324176
yuyuyuyu12345楼主2022/7/6 17:01
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
	int s,v;
	cin>>s>>v;
	double x=1.0*s/v;//计算需要多少分钟;
	int y = s/v;
	if(x>y) y++;//大于一分钟小于两分钟多加一分钟 
	y+=10; 
	int hours=0;
	int min=y;
	if(y/60>24) return 0;
	if(y>=60){//y为分钟,hours是需要走几小时 
		y/=60;
		hours+=y;
		min%=60;
	} 
	if(hours>7){//大于7小时就是需要前一天走 
		hours=hours-7;
		hours=24-hours;
		cout<<hours<<':'<<60-min;
	}
	else cout<<'0'<<7-hours<<':'<<60-min;
	return 0;
 } 
2022/7/6 17:01
加载中...