Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
49241 seanlsy 【AB-1】函数 C++ 运行超时 40 1000 MS 14800 KB 824 2022-05-04 22:15:38

Tests(4/10):


#include <bits/stdc++.h> using namespace std; #define mod 998244353 inline int read(){ int x=0;bool f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=0;ch=getchar();} while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();} return f?x:-x; } int n,k1,k2,K; long long f[55][20005]; inline int Pow(int x,int y){ int res=1; while(y){ if(y&1) res=res*x%11; y>>=1; x=x*x%11; } return res; } #define f(x,y) (11+Pow(k1,n-y+1)%11)%11*x int main(){ n=read(),K=read(),k1=read(),k2=read(); f[2][Pow(k1,n)*k1+Pow(k1,n-1)*k2+10000]=1; for(int i=3;i<=n+1;i++) for(int j=-10000;j<=10000;j++) for(int k=-K;k<=K;k++) if(-10000<=j-f(k,i)&&j-f(k,i)<=10000) f[i][j+10000]+=f[i-1][j-f(k,i)+10000],f[i][j+10000]%=mod; printf("%lld\n",f[n+1][k2+10000]); return 0; }


测评信息: