不懂就问
查看原帖
不懂就问
1074157
SANJIAOJIE楼主2025/1/26 16:28

为什么第 77 行的 string 改成 char 就对了?

#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
long long dp[20];
int main(){
    dp[0]=1;
    string c[20]=" helloworld";
    char s;
    while((s=getchar())!=EOF){
        for(int i=10;i>=1;i--)if(s==c[i]||s+32==c[i])dp[i]=(dp[i-1]+dp[i])%mod;
    }
    cout<<dp[10];
    return 0;
}
2025/1/26 16:28
加载中...