Recent Posts
«   2024/11   »
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
Today
Total
관리 메뉴

Try

[Programmers/C++] 2016년 본문

Algorithm/Programmers

[Programmers/C++] 2016년

HAS3ONG 2018. 11. 18. 17:25

출처

https://programmers.co.kr/learn/courses/30/lessons/12901




소스


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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <string>
#include <vector>
#include <iostream>
 
using namespace std;
 
string solution(int a, int b) {
    string answer = "";
    string day[] = {"THU","FRI","SAT","SUN","MON","TUE","WED"};
    
    if(a==1)
    {}
    else if(a==2)
    {
        b = b+31;
    }
    else if(a==3)
    {
        b = b+60;
    }
    else if(a==4)
    {
        b = b+91;
    }
    else if(a==5)
    {
        b = b+121;
    }
    else if(a==6)
    {
        b = b+152;
    }
    else if(a==7)
    {
        b = b+182;
    }
    else if(a==8)
    {
        b = b+213;
    }
    else if(a==9)
    {
        b = b+244;
    }
    else if(a==10)
    {
        b = b+274;
    }
    else if(a==11)
    {
        b = b+305;
    }
    else if(a==12)
    {
        b = b+335;
    }
    
    b = b % 7;
    answer = day[b];
    
    return answer;
}
cs


Comments