1026 程序運行時間
阿新 • • 發佈:2018-08-31
temp style ace code 程序 get out cin ref
題目鏈接:https://pintia.cn/problem-sets/994805260223102976/problems/994805295203598336
題解:
1 #include <iostream> 2 using namespace std; 3 4 int main() { 5 int c1, c2, hh, mm, ss; 6 cin >> c1 >> c2; 7 int temp = (c2 - c1 + 50) / 100;//四舍五入,易錯 8 hh = temp / 3600, mm = temp % 3600 / 60, ss = temp % 3600% 60; 9 if (hh < 10) cout << "0"; 10 cout << hh << ":"; 11 if (mm < 10) cout << "0"; 12 cout << mm << ":"; 13 if (ss < 10) cout << "0"; 14 cout << ss; 15 return 0; 16 }
1026 程序運行時間