반응형
문제 설명
https://softeer.ai/practice/6254
(저작권으로 인해 링크로 대체합니다!)
코드 풀이
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int hh = 0;
int mm = 0;
//월,화,수,목,금
for(int i=0; i<5; i++){
String a = sc.next(); //출근 시간
String b = sc.next(); //퇴근 시간
String[] atime = a.split(":");
String[] btime = b.split(":");
hh += Integer.parseInt(btime[0]) - Integer.parseInt(atime[0]);
mm += Integer.parseInt(btime[1]) - Integer.parseInt(atime[1]);
}
System.out.println(hh*60 + mm);
}
}
실행 결과
반응형
'개발일지 > 코테 정복기' 카테고리의 다른 글
[Softeer/JAVA] (LV.1) 위험한 효도 (0) | 2024.06.20 |
---|---|
[Softeer/JAVA] A+B(LV.1) (0) | 2024.06.13 |
[Softeer/JAVA] 주행거리 비교하기(LV.1) (0) | 2024.06.07 |
[Softeer/JAVA] 나무 심기(LV.1) (0) | 2024.06.07 |
[프로그래머스/JAVA] 문자열 섞기 (0) | 2024.03.29 |