-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path5622.cpp
More file actions
53 lines (50 loc) · 735 Bytes
/
5622.cpp
File metadata and controls
53 lines (50 loc) · 735 Bytes
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
// 5622. 다이얼
// 2019.05.21
// 문자열 처리
#include<iostream>
#include<string>
using namespace std;
int main()
{
string a;
cin >> a;
int ans = 0;
// 문자에 따라 ans에 값 추가
for (int i = 0; i < a.size(); i++)
{
if (('A' <= a[i] && a[i] <= 'C'))
{
ans += 3;
}
if (('D' <= a[i] && a[i] <= 'F'))
{
ans += 4;
}
if (('G' <= a[i] && a[i] <= 'I'))
{
ans += 5;
}
if (('J' <= a[i] && a[i] <= 'L'))
{
ans += 6;
}
if (('M' <= a[i] && a[i] <= 'O'))
{
ans += 7;
}
if (('P' <= a[i] && a[i] <= 'S'))
{
ans += 8;
}
if (('T' <= a[i] && a[i] <= 'V'))
{
ans += 9;
}
if (('W' <= a[i] && a[i] <= 'Z'))
{
ans += 10;
}
}
cout << ans << endl;
return 0;
}