Files
python/LuoGu/RuMen/P1765.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

45 lines
961 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false); //读入输出优化的强迫症
map<char, int> _map;//表示以char类型为下标存储的是int
_map['a'] = 1;
_map['b'] = 2;
_map['c'] = 3;
_map['d'] = 1;
_map['e'] = 2;
_map['f'] = 3;
_map['g'] = 1;
_map['h'] = 2;
_map['i'] = 3;
_map['j'] = 1;
_map['k'] = 2;
_map['l'] = 3;
_map['m'] = 1;
_map['n'] = 2;
_map['o'] = 3;
_map['p'] = 1;
_map['q'] = 2;
_map['r'] = 3;
_map['s'] = 4;
_map['t'] = 1;
_map['u'] = 2;
_map['v'] = 3;
_map['w'] = 1;
_map['x'] = 2;
_map['y'] = 3;
_map['z'] = 4;
_map[' '] = 1;
string str = "";
//输入一个字符串
getline(cin, str);
int l = 0;
for (int i = 0; i < str.length(); i++) {
l += _map[str[i]];
}
cout << l << endl;
return 0;
}