80分!求助 感谢

P1425 小鱼的游泳时间

```cpp #include <iostream> using namespace std; int main(){ int a,b,c,d; cin>>a>>b>>c>>d; int e,f; if(d>=b){ f=d-b; e=c-a; }else{ f=d+60-b; e=c-a-1; } cout<<e<<" "<<f ; return 0 ; } ``` 这样可以很好的模拟出人工算时间的方法。
by Godiva @ 2022-10-01 11:02:14


代码有纰漏。 例如`13 0 14 20`这一组数据应当输出`1 20`,实际上输出了`0 80` 改的话可以把`f == 60`的条件改成`f >= 60` 然后内部`f -= 60`
by InfinityEnergy @ 2022-10-01 11:05:28


``` #include<bits/stdc++.h> using namespace std; int main(){ int a,b,c,d,e,f; cin>>a>>b>>c>> d; if(b>d){ e=c-1-a; f=d+60-b; cout<<e<<" "<<f<< endl; } else{ e=c-a; f=d-b; cout<<e<<" "<<f<< endl; } return 0; }
by LZX0909 @ 2022-10-01 11:10:23


谢谢大家,已经通过了 感谢
by CYF123469 @ 2022-10-01 11:49:58


|