提交时间:2022-04-12 12:48:12
运行 ID: 48361
#include<bits/stdc++.h> using namespace std; inline long long read() { int x=0,f=1; char t=getchar(); while(t<'0'||t>'9'){if(t=='-')f=0;t=getchar();} while(t>='0'&&t<='9')x=(x<<1)+(x<<3)+(t^48),t=getchar(); return f?x:-x; } int n,K,k1,k2; map<int,map<int,int> > f; int main() { n=read(),K=read(),k1=read(),k2=read(); f[1][k1]=1; f[2][k1+k2]=1; for(int i=1;i<=n+1;i++) for(int k=-K;k<=K;k++) for(int o=pow(k1,n-i+1)*k;o<=k2;o++) { f[i][o]+=f[i-1][int(o-pow(k1,n-i+1)*k)]%11; } cout<<f[n+1][k2]; return 0; }