P1765非打表0pts求助
  • 板块学术版
  • 楼主__Cow__
  • 当前回复3
  • 已保存回复3
  • 发布时间2022/10/1 17:38
  • 上次更新2023/10/27 09:20:11
查看原帖
P1765非打表0pts求助
589272
__Cow__楼主2022/10/1 17:38

所以正解本来就是打表?

#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

就能过?这里的elseelse if有区别吗??

2022/10/1 17:38
加载中...