Duration
Duration
https://ac.nowcoder.com/acm/contest/5667/D
把时间都转化成秒即可;
#include<bits/stdc++.h> using namespace std; string a,b; int main() { cin>>a>>b; int cnt=0,sum=0; int k=((b[0]-'0')*10+(b[1]-'0'))*3600; int h=((a[0]-'0')*10+(a[1]-'0'))*3600; k+=((b[3]-'0')*10+(b[4]-'0'))*60; h+=((a[3]-'0')*10+(a[4]-'0'))*60; k+=(b[6]-'0')*10+(b[7]-'0'); h+=(a[6]-'0')*10+(a[7]-'0'); cout<<abs(h-k); }