ssd,~~jbl~~
by _l_l_l_l_l_ @ 2021-08-18 22:07:06
怎么说呢,无论这题有多难,你都要有自己思考的过程,你说你代码打出来了但是WA让我们找错能理解,直接说不会要我们讲讲?题解干什么的?何况这是个入门红题??
by 孤城疲惫了吖 @ 2021-08-18 22:07:25
@[wangjy001](/user/555052)
方法一,换算成分钟,计算之后再转换回去
```cpp
#include<cstdio>
int main(){
int a,b,c,d,e,f,g,h,i;
scanf("%d %d %d %d",&a,&b,&c,&d);
e=a*60+b;
f=c*60+d;
g=f-e;
h=g/60;
i=g%60;
printf("%d %d",h,i);
return 0;
}
```
方法二,像小学学过的那样直接硬减,减不够就借位,借 $60$ 分钟就行了
```cpp
#include<iostream>
using namespace std;
int a,b,c,d;
int main(){
cin>>a>>b>>c>>d;
if(b>d)
cout<<c-1-a<<' '<<d+60-b;
else
cout<<c-a<<' '<<d-b;
return 0;
}
```
都是 $AC$ 的,勿抄。
by qwq___qaq @ 2021-08-18 22:08:07
你为什么不看题解呢
by Dragonbell_exp @ 2021-08-18 22:08:41
ssd
jbl
sqlm
by 孤城疲惫了吖 @ 2021-08-18 22:09:51
```cpp
#include <stdio.h> //头文件
int a,b,c,d,s,ans;
int main()
{scanf("%d%d%d%d",&a,&b,&c,&d); //输入a,b,c,d
if (d-b<0) { //这种情况是分钟需要接小时一小时的
s=c-a-1;
ans=d-b+60;
}
else { //这种情况是所有的东西都不会退位的
s=c-a;
ans=d-b;
}
printf("%d %d",s,ans); //输出答案
}
```
by int64 @ 2021-08-18 22:16:04