28分求助
查看原帖
28分求助
431494
SYM3168045288楼主2021/7/20 10:53
#include<bits/stdc++.h>
using namespace std;
bool t[12] = {false};
bool bull(short x,short y){
	int p1=0,p2=0;
	p1 = x*(y/10);
	p2 = x*(y%10);
	int p3 = p1*p2;
	if(p1>=100&&p1<=999&&p2>=100&&p2<=999){
		if(t[p1%100]&&t[p1%10/10]&&t[p1/100]&&t[p2%100]&&t[p2%10/10]&&t[p2/100]){
			if(t[p3%1000]&&t[p3/10%100]&&t[p3/100%10]&t[p3/1000]){
				return 1;
			}
			else{
				return 0;
			}
		}
		else{
			return 0;
		}
	}
	else{
		return 0;
	}
}
int main(){
	int n,f,sum=0;
	cin>>n;
	for(int i = 1;i<=n;i++){
		cin>>f;
		t[f] = true;
	}
	for(int i = 100;i<=999;i++){
		if(t[i%100]&&t[i%10/10]&&t[i/100]){
			for(int j = 10;j<=99;j++){
				if(t[j/10]&&t[j%10]){
				    if(bull(i,j)==1){
				    	sum++;
					}
				}
			}
		}
	}
	cout<<sum;
	return 0;
}
2021/7/20 10:53
加载中...