반응형
문제 이해
아이디어
코드
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for (int tc = 1; tc <= T; ++tc) {
int h1 = sc.nextInt();
int m1 = sc.nextInt();
int h2 = sc.nextInt();
int m2 = sc.nextInt();
int h3 = h1 + h2, m3 = m1 + m2;
while (m3 > 59) {
m3 -= 60;
h3++;
}
while (h3 > 12) {
h3 -= 12;
}
System.out.printf("#%d %d %d\n", tc, h3, m3);
}
}
}
집사는개발자가되고파
choppadontbiteme.tistory.com
반응형
'Algorithm > SWEA' 카테고리의 다른 글
[SWEA] 1983. 조교의 성적 매기기 D2 JAVA (0) | 2021.03.26 |
---|---|
[SWEA] 1979. 어디에 단어가 들어갈 수 있을까 D2 JAVA (0) | 2021.03.26 |
[SWEA] 1974. 스도쿠 검증 D2 JAVA (0) | 2021.03.26 |
[SWEA] 1961. 숫자 배열 회전 D2 JAVA (0) | 2021.03.25 |
[SWEA] 1970. 쉬운 거스름돈 D2 JAVA (0) | 2021.03.25 |