Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long int ll;
- string s[200],res[200],rule;
- ll n;
- void pass(ll pos)
- {
- if(pos==rule.size())
- {
- for(int i=0;i<pos;i++)
- cout<<res[i];
- cout<<endl;
- return ;
- }
- else if(rule[pos]=='#')
- {
- for(int i=0;i<n;i++)
- {
- res[pos]=s[i];
- pass(pos+1);
- }
- }
- else
- {
- for(int i=0;i<10;i++)
- {
- res[pos]=i+'0';
- pass(pos+1);
- }
- }
- }
- int main()
- {
- ll i,j,k,com,a,b,c,d,e;
- while(cin>>n)
- {
- for(i=0;i<n;i++)
- cin>>s[i];
- cin>>com;
- cout<<"--"<<endl;
- while(com--)
- {
- cin>>rule;
- pass(0);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement