C
[2] 백준 오븐의 요리 완료 시간 구하기 문제
엽동이
2022. 6. 19. 22:48
#include <stdio.h>
int main(void){
int hour, minute, makingtime, total;
scanf("%d %d", &hour, &minute);
scanf("%d", &makingtime);
total = minute + makingtime;
if(hour == 23 && minute + makingtime >= 60)
{
hour += total / 60;
total = total - 60 * (total / 60);
if(hour >= 24)
{
printf("%d %d", 0 + hour - 24, total);
}
else
{
printf("%d %d", hour, total);
}
}
else if(total >= 60)
{
hour += total / 60;
total = total - 60 * (total / 60);
if(hour >= 24)
{
printf("%d %d", 0 + hour - 24, total);
}
else
{
printf("%d %d", hour, total);
}
}
else
{
printf("%d %d", hour, total);
}
return 0;
}