Time Card
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0532
解法:h,mをsに直して普通に計算
#include<iostream> #include<cmath> using namespace std; int main() { double h1,h2,m1,m2,s1,s2; while (cin >> h1 >> m1 >> s1 >> h2 >> m2 >> s2) { double r1 = h1*60*60+m1*60+s1; double r2 = h2*60*60+m2*60+s2; double re = r2 - r1; int rh = (int) floor(re / (60 * 60)); re -= rh * (60*60); int rm = (int) floor(re / (60)); re -= rm * (60); int rs = (int) re; cout << rh << " " << rm << " " << rs << endl; } }