社区讨论

P1765非打表0pts求助

学术版参与者 3已保存回复 3

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
3 条
当前快照
1 份
快照标识符
@lo7xeyvw
此快照首次捕获于
2023/10/27 09:20
2 年前
此快照最后确认于
2023/10/27 09:20
2 年前
查看原帖
所以正解本来就是打表?
CPP
#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有区别吗??

回复

3 条回复,欢迎继续交流。

正在加载回复...