Huangc 2013-06-23 19:45:00
点我顶贴
收藏
删除
[color=green]测试结果1: 通过本测试点|有效耗时204ms
测试结果2: 通过本测试点|有效耗时62ms
测试结果3: 通过本测试点|有效耗时47ms
测试结果4: 通过本测试点|有效耗时62ms
测试结果5: 通过本测试点|有效耗时63ms
测试结果6: 通过本测试点|有效耗时125ms
测试结果7: 通过本测试点|有效耗时46ms
测试结果8: 通过本测试点|有效耗时47ms
[color=red]测试结果9: 测试结果错误.错误结果为:222
正确结果应为:0
[color=green]测试结果10:通过本测试点|有效耗时46ms
[color=blue]
代码如下:
#include<iostream>
#include<cstring>
using namespace std;
int n=0,s[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};
string a;
int main()
{
getline(cin,a);
for (int i=0;i<=a.size()-1;i++)
{
if (a[i]==' ') n++;
else
n+=s[a[i]-96];
}
cout << n;
return 0;
}
求大牛解释啊!!!!!!
#1 Huangc@2013-06-23 19:45:00
30140
回复
删除
顶
顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶
欲知大牛在何处。