80分求助

P1425 小鱼的游泳时间

```cpp #include<bits/stdc++.h> using namespace std; int main() { int a,b,c,d,e,f; cin>>a>>b>>c>>d; e=c-a; if(b>d) { f=(60+d)-b; e--; } else f=b-d; cout<<e<<" "<<f<<endl; return 0; } ```
by ZMY_illusion @ 2021-09-21 14:45:37


@[Z66M99Y](/user/479204) 这样就行了,你写反了 ```cpp #include<bits/stdc++.h> using namespace std; int main() { int a,b,c,d,e,f; cin>>a>>b>>c>>d; e=c-a; if(b>d) { f=(60+d)-b; e--; } else f=d-b; cout<<e<<" "<<f<<endl; return 0; } ``` ~~怎么还有人会把代码写反的啊啊啊啊啊啊啊啊~~
by ajahjahah @ 2021-09-21 15:10:20


``` #include<iostream> using namespace std; int main() { int a,b,c,d,m1,m2,h,hour,min; cin>>a>>b>>c>>d; m1=60*a+b; m2=60*c+d; h=m2-m1; hour=h/60; min=h%60; cout<<hour<<" "<<min<<endl; return 0; } ``` ## 这程序虽然变量多了点,但个人觉得挺好理解的
by Code_星云 @ 2021-09-21 15:11:22


没错我是个大傻子(亻
by ZMY_illusion @ 2021-09-21 15:14:18


```cpp #include <bits/stdc++.h> using namespace std; int main() { int a,b,c,d,e,f,g,h,i; cin>>a>>b>>c>>d; e=a*60+b; f=c*60+d; g=f-e; h=g/60; i=g%60; cout<<h<<' '<<i; return 0; } ``` 把小时换成分钟
by ONT_ @ 2021-10-27 21:13:50


|