출처 : 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);
}
}
}
'알고리즘' 카테고리의 다른 글
[SWEA/JAVA] 2805 농작물 수확 (0) | 2024.11.16 |
---|---|
[SWEA/JAVA] 4522 세상의 모든 팰린드롬 (1) | 2024.11.15 |
[SWEA/JAVA] 1979 어디에 단어가 들어갈 수 있을까 (2) | 2024.11.13 |
[SWEA/JAVA] 1230 암호문3 (0) | 2024.11.12 |
[SWEA/JAVA] 2001 파리퇴치 (0) | 2024.11.11 |