Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
48168 wssdr 【AB-1】函数 C++ 解答错误 30 107 MS 8008 KB 592 2022-04-10 11:51:55

Tests(3/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*a%11; return t*t%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+K]=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(0);k<=(K<<1);++k) if(j>=(k-K)*x) dp[i][j]=(dp[i][j]+dp[i-1][j-(k-K)*x])%mod; } cout<<dp[n+1][k2+K]<<endl; return 0; }


测评信息: