正式AFO @ 2018-09-22 16:54:38
#include<iostream>
#include<cstdio>
#include<queue>
#include<cmath>
using namespace std;
int a, b, c, sum;
int vis[100000];
int main(){
cin >> a >> b >> c;
for(int i = 123; i <= 987; i++){
if(i%10==i/10%10||i%10==i/10/10||i/10%10==i/10/10)
continue;
vis[i % 10]=1;
vis[i / 10 % 10] = 1;
vis[i / 10 / 10] = 1;
for(int j = 123; j <= 987; j++){
if(j%10==j/10%10||j%10==j/10/10||j/10%10==j/10/10)
continue;
if(vis[j % 10]==1
||vis[j / 10 % 10] == 1
||vis[j / 10 / 10] == 1)
continue;
vis[j % 10]=1;
vis[j / 10 % 10] = 1;
vis[j / 10 / 10] = 1;
for(int k =123; k <= 987; k++){
if(k%10==k/10%10||k%10==k/10/10||k/10%10==k/10/10)
continue;
if(vis[k % 10]==1
||vis[k / 10 % 10] == 1
||vis[k / 10 / 10] == 1)
continue;
if(i * b == j * a && i * c == k * a){
cout << i << " " << j << " " << k;
cout << endl;
sum++;
}
}
vis[j % 10]=0;
vis[j / 10 % 10] = 0;
vis[j / 10 / 10] = 0;
}
vis[i % 10]=0;
vis[i / 10 % 10] = 0;
vis[i / 10 / 10] = 0;
}
if(sum == 0){
cout << "No!!!";
}
return 0;
}
by 镉八君 @ 2018-09-22 17:13:13
看起来不够暴力啊(今天才A了这道题)QWQ