[C++][백준 2525] 오븐 시계

PublicMinsu·2025년 8월 12일

문제

https://www.acmicpc.net/problem/2525

접근 방법

시간은 분으로 환산할 수 있다는 점을 활용하면 됩니다.

코드

#include <iostream>
using namespace std;
int A, B, C;
int main()
{
    ios::sync_with_stdio(0), cin.tie(0);
    cin >> A >> B >> C;
    int min = A * 60 + B + C;
    min %= 1440;

    cout << (min / 60) << " " << (min % 60);
    return 0;
}

풀이

시간을 분으로 환산하고 환산된 분을 가지고 연산을 해주면 됩니다.

profile
연락 : publicminsu@naver.com

0개의 댓글