c++求助
查看原帖
c++求助
925416
LXM1楼主2023/1/9 17:56
#include<bits/stdc++.h>
#include<cstdio> 
int main(){
	using namespace std;
	
	int s, v;
	cin>>s>>v; 
	
    double t_walk=s/v;
    int t_a=(24+8)*60;//以前一天零点为基准点,基准点到当天早上8点的时间定义为 t_a=(24+8)*60,单位为 min 
    int t_manage=10;
	double t_b=(t_a-t_walk-t_manage)/60;//定义 t_b 为 基准点减去花费的总时间,单位为 h
	 
	if(t_b>24){
		int ans1=t_b-24;
		double ans2=t_b-24;
		cout<<"0"<<ans1<<":";
		printf("%02d",ans2);
	} 
	
	if(t_b=24){
		cout<<"00:00";
	}
	
	if(t_b<24){
		int ans3=t_b;
		double ans4=t_b;
		cout<<ans3<<":";
	    printf("%02d",ans4);
	}
	 
	
	return 0;
} 
2023/1/9 17:56
加载中...