SW ExpertAcademy/D2
1976. 시각 덧셈
Programmer.
2018. 12. 1. 02:13
1976. 시각 덧셈
풀이 방법
<코드>
#include<iostream> using namespace std; int main(int argc, char** argv) { std::ios::sync_with_stdio(false); std::cout.tie(nullptr); std::cin.tie(nullptr); int test_case; int T; cin >> T; for (test_case = 1; test_case <= T; ++test_case) { int h1{}, m1{}, h2{}, m2{}; std::cin >> h1 >> m1 >> h2 >> m2; int resulth = h1 + h2; int resultm = m1 + m2; int temp = resultm / 60; resulth += temp; resultm = resultm % 60; if (resulth > 12) resulth -= 12; std::cout << "#" << test_case << " " << resulth << " " << resultm << "\n"; } return 0;//정상종료시 반드시 0을 리턴해야합니다. }