https://school.programmers.co.kr/learn/courses/30/lessons/12901
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
#include <string>
#include <vector>
using namespace std;
string solution(int a, int b) {
string answer = "";
vector<string> week = { "THU","FRI", "SAT" ,"SUN", "MON", "TUE", "WED"};
vector<int> month = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int days = 0;
for (int i = 1; i < a; i++) days += month[i-1];
days += b;
answer = week[days % 7];
return answer;
}
'코딩테스트 > 문제풀이' 카테고리의 다른 글
[220808] Level1_ 두 개 뽑아서 더하기 (0) | 2022.08.08 |
---|---|
[220807] Level_ 1 모의고사 (0) | 2022.08.07 |
[220805] Level_ 1 완주하지 못한 선수 (오답노트) (0) | 2022.08.05 |
[220803] Level1_ 로또의 최고 순위와 최저 순위 (0) | 2022.08.03 |
[220801] Level1_ 체육복 (0) | 2022.08.03 |