1 solutions
-
0
#include<bits/stdc++.h> using namespace std; typedef long long LL; const int N=1e5+10; LL n,x; int ans=0; vector<LL> g[N]; void dfs(LL u,LL s) { if(u==n) //枚举完了所有组 { if(s==x) ans++; return ; } for(auto j:g[u]) { if(s*j>x) continue;//越界 dfs(u+1,s*j);//去下一个位置(累乘) } } int main() { cin>>n>>x; for(int i=0;i<n;i++) { int t; cin>>t; while(t--) { int x; cin>>x; g[i].push_back(x); } } dfs(0,1); //搜索 cout<<ans; return 0; }
- 1
Information
- ID
- 2753
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 3
- Tags
- # Submissions
- 21
- Accepted
- 6
- Uploaded By