Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 알고리즘
- java
- 백준
- BOJ
- 이클립스
- 확인문제
- 인강
- 프로그래머스
- 중소기업면접
- 한국재정정보원
- 코딩
- 필기후기
- CSS
- 연결요소의개수
- 필기
- 부스트코스
- 웹개발
- HTML
- 웹
- 정수내림차순으로배치하기
- 수박수박수박수박수?
- 건보필기
- Linux
- 공부
- 프로그래밍
- 프로그래밍언어
- algorithm
- 농은면접
- 웹프로그래밍
- 후기
Archives
- Today
- Total
공부하는 히욤이
2056. 연월일 달력 본문
SW Expert 2056. 연월일 달력
* 문제의 저작권은 SW Expert에 있습니다
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | import java.io.BufferedReader; import java.io.InputStreamReader; public class Solution { static String Answer; static int[] dayofMonth = {0, 31,28,31,30,31,30,31,31,30,31,30,31}; static String answer; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); //BufferedReader br = new BufferedReader(new FileReader("input.txt")); int T = Integer.parseInt(br.readLine()); for(int test_case = 0; test_case < T; test_case++) { String s = br.readLine(); int month = Integer.parseInt(s.substring(4, 6)); int day = Integer.parseInt(s.substring(6, 8)); if (month >0 && month <13 && day >0 && day<=dayofMonth[month]) { answer = String.format("%s/%s/%s", s.substring(0,4), s.substring(4,6), s.substring(6,8)); } else { answer = "-1"; } System.out.format("#%d %s", (test_case+1), answer); System.out.println(); } br.close(); } } | cs |
'Algorithm > SW Expert Academy' 카테고리의 다른 글
1989. 초심자의 회문 검사 (0) | 2019.01.23 |
---|---|
1986. 지그재그 숫자 (0) | 2019.01.23 |
2071. 평균값 구하기 (0) | 2019.01.11 |
2063. 중간값 찾기 (0) | 2019.01.11 |
1545. 거꾸로 출력해 보아요 (0) | 2019.01.11 |