求改正,80分
by gh1226843123 @ 2017-08-11 09:03:19
在你的 if(d>=b)条件里面的f=d-e应该是f=d-b,这种错误要少犯
其实这题还不算坑,它没有给你类似23:20-2:50 这样的过夜点
by half_cooler @ 2017-08-11 09:59:03
谢谢
by gh1226843123 @ 2017-08-13 10:22:33
```cpp
#include<iostream>
using namespace std;
int main()
{
int a,b,c,d,e,f;//起始时间:a时b分。结束时间:c时d分。游泳时间:e时f分
cin>>a>>b>>c>>d;
if(d>=b)
{
f=d-b;
e=c-b;
}
else
{
if(d<b)
{
f=d+60-b;
e=c-1-a;
}
}
cout<<e<<f<<endl;
return 0;
}
还不对……0分
```
by gh1226843123 @ 2017-08-13 10:27:22
```cpp
#include<iostream>
using namespace std;
int main()
{
int a,b,c,d,e,f;//起始时间:a时b分。结束时间:c时d分。游泳时间:e时f分
cin>>a>>b>>c>>d;
if(d>=b)
{
f=d-b;
e=c-b;
}
else
{
if(d<b)
{
f=d+60-b;
e=c-1-a;
}
}
cout<<e<<" "<<f<<endl;
return 0;
}
```
by namespace @ 2017-08-16 14:57:15
额...
好吧...
```cpp
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a,b,c,d;
cin>>a>>b>>c>>d;
if(d-b<0)
{
c--;
d=d+60;
}
cout<<c-a<<" "<<d-b;
return 0;
}
```
by return先生 @ 2017-08-16 21:11:08
```cpp
#include <iostream>
using namespace std;
int main()
{
int a,b,c,d;
cin>>a>>b>>c>>d;
int x=c-a,y=d-b;
if(y<0){x--;y+=60;}
cout<<x<<" "<<y;
return 0;
}
```
by james3041417539 @ 2017-08-22 11:05:05
```cpp
#include <iostream>
#include <cstdio>
using namespace std;
int main() {
int a,b,c,d;
cin >> a >> b >> c >> d;
if(d>=b) {
cout << (c-a) << " " << (d-b);
}
else {
cout << (c-a-1) << " " << (60-b+d);
}
return 0;
}
```
by superPi @ 2017-08-22 17:18:47