求!易!语!言!解!法!
by huyufeifei @ 2019-04-29 18:56:46
求 $\text{!H!a!s!k!e!l!l!}$ 解!法!
by yurzhang @ 2019-04-29 18:58:03
```
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
int ans=0;
string a;
getline(cin,a);
for(int i=0;i<a.size();i++)
{
if(a[i]=='a'||a[i]=='d'||a[i]=='g'||a[i]=='j'||a[i]=='m'||a[i]=='p'||a[i]=='t'||a[i]=='w') ans++;
if(a[i]=='b'||a[i]=='e'||a[i]=='h'||a[i]=='k'||a[i]=='n'||a[i]=='q'||a[i]=='u'||a[i]=='x') ans+=2;
if(a[i]=='c'||a[i]=='f'||a[i]=='i'||a[i]=='l'||a[i]=='o'||a[i]=='r'||a[i]=='v'||a[i]=='y') ans+=3;
if(a[i]=='s'||a[i]=='z') ans+=4;
if(a[i]==' ') ans++;
}
cout<<ans;
return 0;
}
```
by 灵光一闪 @ 2019-04-29 19:01:31
有没有
```
#include<bits/stdc++.h>
using namespace std;
int main()
```
就可以解的......
by 退役の鱼 @ 2019-04-29 19:04:26
```
#include<iostream>
#include<cstring>
using namespace std;
int zh(char c)//将字母转换为数字
{
return c-'a'+1;
}
const int cs[27]={0,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 main()
{
int ans;
char str[210];
gets(str);
int len=strlen(str);
for(int i=0;i<len;i++)
{
if(str[i]==' ')ans+=1;
else
ans+=cs[zh(str[i])];
}
cout<<ans;
return 0;
}
```
当然我也不知道为什么一堆警告
by __gcd @ 2019-04-29 19:08:20
@[爸爸最帅了](/space/show?uid=173431) 头文件换一下就行
by __gcd @ 2019-04-29 19:09:33
@[梁宸铭123](/space/show?uid=149192)
蟹蟹
by 退役の鱼 @ 2019-04-29 19:10:38
求!P!y!t!h!o!n!解!法!
by Smile_Cindy @ 2019-04-29 19:12:22
@[爸爸最帅了](/space/show?uid=173431) 不客气~~
by __gcd @ 2019-04-29 19:12:33
求!P!a!s!c!a!l!解!法!
by aminoas @ 2019-04-29 19:13:10