File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 273
273
| 205 | [ 저항] ( https://www.acmicpc.net/problem/1076 ) | [ cpp] ( source/1076.cpp ) | 206 | [ 공사장 표지판] ( https://www.acmicpc.net/problem/23055 ) | [ cpp] ( source/23055.cpp ) |
274
274
| 207 | [ Ресторан] ( https://www.acmicpc.net/problem/23738 ) | [ cpp] ( source/23738.cpp ) | 208 | [ 자동완성] ( https://www.acmicpc.net/problem/24883 ) | [ cpp] ( source/24883.cpp ) |
275
275
| 209 | [ 팰린드롬] ( https://www.acmicpc.net/problem/10174 ) | [ cpp] ( source/10174.cpp ) | 210 | [ 냉동식품] ( https://www.acmicpc.net/problem/14625 ) | [ cpp] ( source/14625.cpp ) |
276
+ | 211 | [ 문어 숫자] ( https://www.acmicpc.net/problem/1864 ) | [ cpp] ( source/1864.cpp ) | | | |
276
277
277
278
</details >
278
279
Original file line number Diff line number Diff line change
1
+ // 1864. 문어 숫자
2
+ // 2022.06.19
3
+ // 구현
4
+ #include < iostream>
5
+ #include < map>
6
+ #include < string>
7
+ #include < algorithm>
8
+
9
+ using namespace std ;
10
+
11
+ int main ()
12
+ {
13
+ map<char , int > maps;
14
+ maps.insert ({ ' -' , 0 });
15
+ maps.insert ({ ' \\ ' , 1 });
16
+ maps.insert ({ ' (' , 2 });
17
+ maps.insert ({ ' @' , 3 });
18
+ maps.insert ({ ' ?' , 4 });
19
+ maps.insert ({ ' >' , 5 });
20
+ maps.insert ({ ' &' , 6 });
21
+ maps.insert ({ ' %' , 7 });
22
+ maps.insert ({ ' /' , -1 });
23
+
24
+ while (1 )
25
+ {
26
+ string s;
27
+ cin >> s;
28
+
29
+ if (s == " #" )
30
+ {
31
+ break ;
32
+ }
33
+ reverse (s.begin (), s.end ());
34
+
35
+ int ans = 0 ;
36
+ int mul = 1 ;
37
+ for (int i = 0 ; i < s.size (); i++)
38
+ {
39
+ ans = ans + maps[s[i]] * mul;
40
+ mul *= 8 ;
41
+ }
42
+ cout << ans << endl;
43
+ }
44
+ return 0 ;
45
+ }
You can’t perform that action at this time.
0 commit comments