幽灵特工 @ 2020-07-31 18:05:19
#include<bits/stdc++.h>
using namespace std;
int gcd(int a, int b, int c, int n) {
if (a % n == 0 && b % n == 0 && c % n == 0) {
return n;
}
else {
n--;
gcd(a, b, c, n);
}
}
int main()
{
int A, B, C;
cin >> A >> B >> C;
int n = min(A, min(B, C));
n = gcd(A, B, C, n);
A /= n;
B /= n;
C /= n;
int f=0;
for (int i = 123; i < 985; i++) {
int a = i * A;
int b = i * B;
int c = i * C;
if (100 < a && a < 999 && 100 < b && b < 999 && 100 < c && c < 999) {
int l[9];
l[0] = a / 100;
l[1] = (a % 100) / 10;
l[2] = (a % 10);
l[3] = b / 100;
l[4] = (b % 100) / 10;
l[5] = b % 10;
l[6] = c / 100;
l[7] = (c % 100) / 10;
l[8] = c % 10;
int sum = 0;
int s = 1;
for (int k = 0; k < 9; k++) {
sum += l[k];
s *= l[k];
}
if (sum == 45 && s == 362880) {
cout << a << " " << b << " " << c << " " << endl;
f = 1;
}
}
}
if (f == 0) {
cout << "No!!!" << endl;
}
}
by IceYukino @ 2020-07-31 18:14:57
另外这是升级版,不是原来的三连击,请不要搞错了
by 冰糖鸽子 @ 2020-07-31 18:14:59
@gqh_蒟蒻_or_大佬
那为什么不从,请你先好好看代码再回答好么?别误人子弟
by IceYukino @ 2020-07-31 18:15:11
@demonred 呵呵
by IceYukino @ 2020-07-31 18:15:56
化简之后是这样的:
by 冰糖鸽子 @ 2020-07-31 18:16:04
@gqh_蒟蒻_or_大佬
xxs拉黑了
by IceYukino @ 2020-07-31 18:16:14
41 152 263
by 冰糖鸽子 @ 2020-07-31 18:16:41
@gqh_蒟蒻_or_大佬
我只是问您为什么不能从123开始
by IceYukino @ 2020-07-31 18:16:43
@demonred 然后你i从123开始乘上41可以满足答案?
by IceYukino @ 2020-07-31 18:17:17
@demonred 现在看看谁是xxs,谁误人子弟
by 冰糖鸽子 @ 2020-07-31 18:17:23
@gqh_蒟蒻_or_大佬
就算升级了变得只有比例,懂?