- 产生数
- 2015-03-16 19:26:10 @
#include<iostream>
using namespace std;
int k, x[15], y[15], sum, f[15];
long int n;
bool find(int a){
sum = 1;
for(int i = 0; i < k; i++){
if(a == x[i])
sum = sum + 1;
}
if(sum == 1)
return false;
else
true;
}
void js(int a){
int i = 0;
while(a > 0){
if(find(a%10) == 1)
f[i++] = sum;
a = a/10;
}
}
int main(){
int ans = 1;
cin>>n>>k;
for(int i = 0; i < k; i++)
cin>>x[i]>>y[i];
js(n);
for(int j = 0; j < k; j++)
ans = ans*f[j];
cout<<ans<<endl;
return 0;
}