-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1864.cpp
More file actions
45 lines (40 loc) · 818 Bytes
/
1864.cpp
File metadata and controls
45 lines (40 loc) · 818 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
// 1864. 문어 숫자
// 2022.06.19
// 구현
#include<iostream>
#include<map>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
map<char, int> maps;
maps.insert({ '-', 0 });
maps.insert({ '\\', 1 });
maps.insert({ '(', 2 });
maps.insert({ '@', 3 });
maps.insert({ '?', 4 });
maps.insert({ '>', 5 });
maps.insert({ '&', 6 });
maps.insert({ '%', 7 });
maps.insert({ '/', -1 });
while (1)
{
string s;
cin >> s;
if (s == "#")
{
break;
}
reverse(s.begin(), s.end());
int ans = 0;
int mul = 1;
for (int i = 0; i < s.size(); i++)
{
ans = ans + maps[s[i]] * mul;
mul *= 8;
}
cout << ans << endl;
}
return 0;
}