알고리즘
[SWEA/JAVA] 4299. 태혁이의 사랑은 타이밍
writing turtle
2024. 11. 14. 22:20
출처 : SW Expert Academy
SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
모든 시간을 분으로 환산해서 11일 11시 11분을 빼주면 끝
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int testCase = sc.nextInt();
int o = 11*60*24 + 11*60 + 11; // 11일 11시 11분
for (int tc = 1; tc <= testCase; tc++) {
int day = sc.nextInt();
int hour = sc.nextInt();
int minute = sc.nextInt();
int totalmin = day*60*24 + hour*60 + minute;
int resttime = totalmin - o >= 0 ? totalmin - o : -1;
System.out.println("#" + tc + " " + resttime);
}
}
}