2851: 小A的通勤系列一

http://acm.zzuli.edu.cn/problem.php?id=2851

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    
    
	int m,h,n,k,d;
	char c;
	cin>>h>>c>>m>>n>>d>>k;
	int t=n/k;
	if(t*k==n)
	{
    
    
		int ans=(t-1)*d;
		m+=ans;		
		h=h+m/60;
		m=m%60;
		printf("%2d:%2d\n",h,m);
	}
	else
	{
    
    
		int ans=(t+1)*d;
		m+=ans;
		h=h+m/60;
		m=m%60;
		printf("%02d:%02d\n",h,m);
	}
	return 0;
} 

猜你喜欢

转载自blog.csdn.net/weixin_52341477/article/details/121386342