

-Code
import java.util.Scanner;
public class BOJ34441 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String name = sc.nextLine();
String[] time = sc.nextLine().split(":");
String day = sc.nextLine();
int weather = Integer.parseInt(sc.nextLine());
int snow = Integer.parseInt(sc.nextLine());
int holiday = Integer.parseInt(sc.nextLine());
int hour = Integer.parseInt(time[0]);
int min = Integer.parseInt(time[1]);
int total_min = hour * 60 + min;
// 주말이면 2배
if (day.equals("sat") || day.equals("sun")) {
total_min *= 2;
}
// 날씨 나쁨이면 2배
if (weather == 1) {
total_min *= 2;
}
// 눈이 왔으면 3배
if (snow == 1) {
total_min *= 3;
}
// 공휴일이면 3배
if (holiday == 1) {
total_min *= 3;
}
System.out.println(String.format("%d:%02d", total_min /60, total_min %60));
}
}'Beakjoon&프로그래머스 > Java' 카테고리의 다른 글
| [백준/Java] 34459번 MIT Time (0) | 2025.10.27 |
|---|---|
| [백준/Java] 34447번 Bad Directions (0) | 2025.10.26 |
| [백준/Java] 28939번 Шкаф для обуви (0) | 2025.10.24 |
| [백준/Java] 34429번 Late Larry (0) | 2025.10.23 |
| [백준/Java] 34450번 Partial Transmission (0) | 2025.10.22 |