标签:
/*
ID: modengd1
PROG: crypt1
LANG: C++
*/
#include <iostream>
#include <stdio.h>
#include <memory.h>
using namespace std;
int input[10],N;
bool tag[10000];
int counter()
{
int ans=0;
for(int i=0;i<N;i++)
{
for(int j=0;j<N;j++)
{
for(int k=0;k<N;k++)
{
for(int h=0;h<N;h++)
{
int temp1=input[i]*100+input[j]*10+input[k];
int temp2=temp1*input[h];
if(temp2>999)
continue;
if(tag[temp2])
for(int m=0;m<N;m++)
{
int temp5=temp1*input[m];
if(temp5>999)
continue;
if(tag[temp5])
{
if((temp2*10+temp5)>9999)
continue;
if(tag[temp2*10+temp5])
{
ans++;
}
}
}
}
}
}
}
return ans;
}
int main()
{
freopen("crypt1.in","r",stdin);
freopen("crypt1.out","w",stdout);
memset(tag,false,sizeof(tag));
scanf("%d",&N);
for(int i=0;i<N;i++)
{
scanf("%d",&input[i]);
}
for(int i=0;i<N;i++)
{
for(int j=0;j<N;j++)
{
for(int k=0;k<N;k++)
{
int temp3=input[i]*100+input[j]*10+input[k];
tag[temp3]=true;
for(int m=0;m<N;m++)
{
int temp4=temp3*10+input[m];
tag[temp4]=true;
}
}
}
}
cout<<counter()<<endl;
return 0;
}
标签:
原文地址:http://www.cnblogs.com/modengdubai/p/4763192.html