/*

 * 2016년 요일을 받아서 날짜 구하기

 * 출처 : http://tryhelloworld.co.kr/challenge_codes/176

 */

import java.text.ParseException;

import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.Scanner;


class TryHelloWorld000

{

    public String getDayName(int a, int b) throws ParseException{

        String answer = "";

        

SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");

Scanner sc = new Scanner(System.in);

a = sc.nextInt();

b = sc.nextInt();

Date date = formatter.parse("20160"+a+b);

date = new Date(date.getTime());

answer = date.toString().substring(0, 3);


        

        return answer;

    }

    public static void main(String[] args) throws ParseException

    {

        TryHelloWorld000 test = new TryHelloWorld000();

        int a=5, b=24;

        System.out.println(test.getDayName(a,b));

    }

}



'알고리즘 풀이' 카테고리의 다른 글

Codility ] Lesson1 : BinaryGap  (0) 2018.04.30
Level 1 수박수박수박수박수박수?  (0) 2017.03.30
Level 2 최솟값 만들기  (0) 2017.03.30
Level 1 행렬의 덧셈  (0) 2017.03.30
Level 1 스트링을 숫자로 바꾸기  (0) 2017.03.30

+ Recent posts