https://www.acmicpc.net/problem/5622
#include <iostream>
#include <string>
using namespace std;
int main() {
string dialAlpha;
cin >> dialAlpha;
int sum = 0;
for (int i = 0; i < dialAlpha.length(); i++) {
if (dialAlpha[i] >= 83) {
dialAlpha[i]--;
if(dialAlpha[i] == 89)
dialAlpha[i]--;
}
sum += ((dialAlpha[i] - 65) / 3) + 3;
}
cout << sum ;
}
'Programming > Algorithm' 카테고리의 다른 글
[C++] 백준 2292번 : 벌집 (0) | 2019.02.05 |
---|---|
[C++] 백준 2941번 : 크로아티아 알파벳 (0) | 2019.02.05 |
[C++] 백준 1316 번 : 그룹 단어 체커 (0) | 2019.02.05 |
[C++] 백준 1157번 : 단어 공부 (0) | 2019.02.05 |
[C++]백준 2908번 : 상수 (0) | 2019.02.04 |