小鱼的游泳时间

题目
有一条鱼摆摆发现自己从a时b分一直游泳到当天的c时d分,请你帮小鱼计算一下,它这天一共游了多少时间呢?

输入格式
一行内输入 4 个整数,分别表示 a, b, c, d

输出格式
一行内输出 2 个整数 e 和 f,用空格间隔,依次表示小鱼这天一共游了多少小时多少分钟。其中表示分钟的整数 f 应该小于60。

Sample Input
12 50 19 10

Sample Output
6 20

代码

#include
int main()
{
     
	int a,b,c,d;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	int e=((c*60+d)-(a*60+b))/60;
	int f=((c*60+d)-(a*60+b))%60;
	printf("%d %d",e,f);
	return 0;
 } 

你可能感兴趣的:(菜鸟笔记,算法,c++)