文章
2
粉丝
552
获赞
1
访问
18.8k
#include
using namespace std;
int main(int argc, char const *argv[])
{
string s;
int num[] = {1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 1, 2, 3, 4};
int pston[] = {1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6 , 7, 7, 7, 8, 8, 8, 8};
while(getline(cin, s)){
int ans = 0;
for(int i = 0; i < s.size(); i ++) {
ans += num[(s[i] - 'a')];
if(i != 0 && pston[s[i] - 'a'] == pston[s[i - 1] - 'a']) ans += 2;
}
cout << ans << endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发