所以正解本来就是打表?
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>
using namespace std;
string a;
int mod[1000]={2,3,1},len,ans;
int main()
{
getline(cin,a);
len = a.length();
for (int i=0;i<len;i++)
{
if (a[i]=='s'||a[i]=='z') ans+=4;
else if (a[i]==' ') ans+=1;
else
{
if (a[i]<'s')
{
ans+=(a[i]-96)%3;
if ((a[i]-96)%3==0) ans+=3;
}
else if (a[i]>'s')
{
ans+=mod[(a[i]-96)%3];
}
}
}
printf ("%d\n", ans-1);
return 0;
}
样例过了,自造数据也过,交上去0pts,而且有一个非常奇怪的地方:
如果交打表,https://www.luogu.com.cn/record/88105096
过不了,但是
https://www.luogu.com.cn/record/88105172
就能过?这里的else和else if有区别吗??