완전탐색으로 풀려다가 규칙이 있는거 같아 확인해 보니 풀렸다.
경우의 수로 미리 설정해두고 풀었다.
#include <string>
#include <vector>
using namespace std;
int solution(string word) {
int answer = word.length();
int n[] = { 781, 156, 31, 6, 1 };
string alpha = "AEIOU";
for (int i = 0; i < word.length(); i++)
answer += n[i] * alpha.find(word[i]);
return answer;
}'Coding_Test 연습 > Programmers' 카테고리의 다른 글
| [프로그래머스] (C++) LV2 점프와 순간 이동 (0) | 2022.06.04 |
|---|---|
| [프로그래머스] (C++) LV2 이진 변환 반복하기 (0) | 2022.06.04 |
| [프로그래머스] (C++) LV2 전력망을 둘로 나누기 (0) | 2022.06.02 |
| [프로그래머스] (C++) LV2 구명보트 (0) | 2022.06.01 |
| [프로그래머스] (C++) LV2 주식가격 (0) | 2022.06.01 |