

앞선 문제와 크게 다르지 않습니다.
차이점이라면, 전후 시간차가 고정된 것과, 입력값으로 주어진다는게 차이점.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
int C = sc.nextInt();
// 조리시간 : (A + (B+C)/60) 조리분 : (B+C)%60
int CH = A+(B+C)/60;
int CM = (B+C)%60;
if (CH<24) {
System.out.println(CH + " " + CM);
} else {
System.out.println(CH%24 + " " + CM);
}
}
}'백준 문제풀이 > 조건문' 카테고리의 다른 글
| 2480. 주사위 세개 (0) | 2022.09.11 |
|---|---|
| 2884. 알람 시계 (0) | 2022.09.11 |
| 14681. 사분면 고르기 (0) | 2022.09.11 |
| 2753. 윤년 (0) | 2022.09.11 |
| 9498. 시험 성적 (0) | 2022.09.11 |