본문 바로가기

알고리즘/프로그래머

2016년

#include <string>
#include <vector>

using namespace std;

string solution(int a, int b) {
  
    
    int month[]={31,29,31,30,31,30,31,31,30,31,30,31};
    string day[]={"FRI","SAT","SUN","MON","TUE","WED","THU"};
    int total=0;
    
    for(int i=0; i<a-1; i++){
        total+=month[i];
    }
    total+=b-1;
    
    return day[total%7];
}

'알고리즘 > 프로그래머' 카테고리의 다른 글

정수 제곱근 판별  (0) 2019.11.11
내림차순으로 배치하기  (0) 2019.11.11
문자열 내 p와 y의 개수  (0) 2019.11.08
나누어 떨어지는 숫자 배열  (0) 2019.11.08
문자열 내림차순으로 배치하기  (0) 2019.11.08