---
layout: post
title:  " Programmers - 2016 "
excerpt: " Level 1 : 2016 "
date:   2018-07-24
cate : "algorithm"
tag:
- Programmers

---

## Problem 
Problem URL : **[2016](https://programmers.co.kr/learn/courses/30/lessons/12901)**

---

## [1] Answer Code (18. 07. 24)

{% highlight cpp %}
#include <string>
#include <vector>

using namespace std;

string solution(int a, int b) {
    int month_day[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
    string day_arr[7] = { "MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN" };

    int day = 3;
    for(int i=0; i<a-1; i++){
        day += month_day[i];
    }

    string answer = "";
    day += b;
    day %= 7;
    answer = day_arr[ day ];

    return answer;
}


{% endhighlight %}

---


### [1] Answer Code (18. 07. 24)

* Programmers Problem

* Level 1

* 날짜 계산하는 로직이 떠오르지 않아 당황했다.
Write Programmers Post ' 2016 '
Write Programmers  Post ' 2016 '
