코딩/백준 문제 (브론즈)

[백준/5554/C언어] 심부름 가는 길 _ 풀이

룻밤 2023. 8. 17. 14:15

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

 

5554번: 심부름 가는 길

승균이는 매일 학교, PC방, 학원에 다닌다. 반복되는 일상에 익숙해진 승균이는 이동시간을 단축해서 PC방에 더 오래 머물고 싶었다. 그래서 스톱워치를 들고 이동할 때마다 기록을 잰 후 집

www.acmicpc.net


풀이

#include <stdio.h>
int main() {
	int hts, stp, pta, ath;
	int total = 0;

	scanf("%d", &hts);		// home to school
	scanf("%d", &stp);		// school to pc
	scanf("%d", &pta);		// pc to academy
	scanf("%d", &ath);		// academy to home

	total = hts + stp + pta + ath;
	printf("%d\n", total / 60);		// 분
	printf("%d\n", total % 60);		// 초
	return 0;
}