[D2] 시각 덧셈 - 1976
성능 요약
메모리: 21,212 KB, 시간: 127 ms, 코드길이: 585 Bytes
제출 일자
2023-10-17 17:40
출처: SW Expert Academy, https://swexpertacademy.com/main/code/problem/problemList.do
SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
import java.util.*;
import java.io.*;
class Solution
{
public static void main(String args[]) throws Exception
{
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 resultM = m1 + m2;
int resultH = h1 + h2 + (resultM / 60);
resultM %= 60;
resultH -= resultH > 12? 12 : 0;
System.out.printf("#%d %d %d\n",tc,resultH, resultM);
}
}
}
'알고리즘 - SWEA > D2' 카테고리의 다른 글
[SW expert Academy] SWEA 1970번 쉬운 거스름돈 자바(Java) (1) | 2023.10.17 |
---|---|
[SW expert Academy] SWEA 1974번 스도쿠 검증 자바(Java) (0) | 2023.10.17 |
[SW expert Academy] SWEA 1979번 어디에 단어가 들어갈 수 있을까 자바(Java) (0) | 2023.10.17 |
[SW expert Academy] SWEA 1983번 조교의 성적 매기기 자바(Java) (1) | 2023.10.16 |
[SW expert Academy] SWEA 1984번 중간 평균값 구하기 자바(Java) (1) | 2023.10.16 |