| Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|---|
| 39623 | 22fhq | 【S】T1 | C++ | 通过 | 100 | 62 MS | 14156 KB | 1268 | 2026-01-17 14:09:54 |
#include<bits/stdc++.h> #define int long long using namespace std; void read(int &x){ x=0; char c=getchar(); bool neg=0; for(;!isdigit(c);c=getchar())neg=(c=='-'); for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48); if(neg)x=-x; } #define read2(a,b) read(a),read(b) #define read3(a,b,c) read2(a,b),read(c) int n,m,k,a[205],ans; map<int,int>mp1[205],mp2[205]; void dfs(int p,int sum,int cnt){ if(p>n){ mp1[cnt][sum]++; return; } if(sum>k)return; dfs(p+1,sum,cnt); dfs(p+1,sum+a[p],cnt); if(cnt*20+20>m)return; dfs(p+1,sum+a[p]*a[p]+1,cnt+1); } void slv(){ read3(n,m,k); for(int i=1;i<=n;i++)read(a[i]); // cout<<n<<endl; sort(a+1,a+1+n); int nn=n;n/=2; dfs(1,0,0); swap(n,nn); for(int i=0;i<=m/20;i++)mp1[i].swap(mp2[i]); dfs(nn+1,0,0); // mp1[0][0]++,mp2[0][0]++; for(int i=0;i<=m/20;i++){ // for(auto[x,res]:mp1[i]){ // cout<<x<<" "<<res<<" "<<i<<endl; // } for(int j=0;i+j<=m/20;j++){ for(auto[x,res]:mp1[i]){ ans+=res*mp2[j][k-x]; } } } cout<<ans<<endl; } signed main(){ slv(); return 0; }