Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
48220 wssdr 【AB-1】函数 C++ 通过 100 110 MS 8016 KB 610 2022-04-10 22:03:45

Tests(10/10):


#include<bits/stdc++.h> #define mod 998244353 using namespace std; int n,K,k1,k2; long long dp[55][10005]; int fpow(int a,int b){ if(!b) return 1; int t(fpow(a,b>>1)); if(b&1) return ((t*t%11+11)%11*a%11+11)%11; return (t*t%11+11)%11; } int main(){ std::ios::sync_with_stdio(0); cin.tie(0);cout.tie(0); cin>>n>>K>>k1>>k2; dp[2][fpow(k1,n)*k1+fpow(k1,n-1)*k2+5000]=1ll; for(int i(3);i<=n+1;++i){ int x(fpow(k1,n-i+1)); for(int j(0);j<=10000;++j) for(int k(-K);k<=K;++k) if(j>=k*x) dp[i][j]=(dp[i][j]+dp[i-1][j-k*x])%mod; } cout<<dp[n+1][k2+5000]<<endl; return 0; }


测评信息: