[백준/C++] 5554 - 심부름 가는 길

orangesnail·2025년 8월 9일

백준

목록 보기
135/169

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


전체 코드

차근차근 생각해보면 아주 쉽게 풀 수 있는 문제!

#include <iostream>
using namespace std;

int main() {
    int sec[4];
    int x = 0, y = 0;
    for (int i = 0; i < 4; i++) {
        cin >> sec[i];
        y += sec[i];
        if (y >= 60) {
            x += y / 60;
            y %= 60;
        }
    }
    
    cout << x << endl;
    cout << y << endl;
    return 0;
}
profile
초보입니다. 피드백 환영합니다 😗

0개의 댓글