156C - Cipher DP yy

来源:互联网 发布:oracle默认端口 编辑:程序博客网 时间:2024/04/28 22:06
//操啊,属于同一个字符串变出来的串的和不变啊!!!!!!!!!!!!/*很明显的一个守恒关系居然没有发现。可是不会严格证明*/#include<cstdio>#include<iostream>const int LMT=102;#define LL long long#define mod 1000000007using namespace std;LL dp[LMT][3000];int main(void){    int t;    dp[0][0]=1;    for(int i=1;i<LMT;i++)      for(int j=0;j<3000;j++)       for(int t=1;t<=26;t++)       if(j+t<3000)       {           dp[i][j+t]+=dp[i-1][j];           dp[i][j+t]%=mod;       }     scanf("%d",&t);    while(t--)    {     char str[102];     int len,sum=0;     scanf("%s",str);     for(len=0;str[len];len++)       sum+=str[len]-'a'+1;       cout<<(dp[len][sum]-1+mod)%mod<<endl;    }    return 0;}