幽灵特工 @ 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 Dimly_dust @ 2020-07-31 18:28:48
RE目前就这几种可能
by 幽灵特工 @ 2020-07-31 18:28:58
我觉得i从1开始是对的,在VS上能通过,但我在洛谷的机器上UKE了
by Dimly_dust @ 2020-07-31 18:30:04
@幽灵特工 UKE是评测姬错误,再提交几次就可以了,我这里是RE
by IceYukino @ 2020-07-31 18:30:22
在本机上也可以过,但是洛谷可能玄学RE了
by 幽灵特工 @ 2020-07-31 18:31:02
这个能反馈吗(玄学RE??)
by Dimly_dust @ 2020-07-31 18:36:02
@幽灵特工 这个不清楚,但不建议反馈
by 幽灵特工 @ 2020-07-31 18:37:37
我在我的机器上输出了正确答案,洛谷里A不AC无所谓了 谢谢大家!
by qsceszthn @ 2020-07-31 19:07:17
给你看看我的远古代码吧 你这写的太麻烦了
#include<cstdio>
int main(){
int a,b,c,flag=0,fflag=0;
scanf("%d%d%d",&a,&b,&c);
for(int i=1;i*b<=999&&i*c<=999;i++){
fflag=0;
int x=i*a,y=i*b,z=i*c;
int v[10]={};
while(x)
v[x%10]++,x/=10;
while(y)
v[y%10]++,y/=10;
while(z)
v[z%10]++,z/=10;
for(int j=1;j<=9;j++)
if(!v[j])
fflag=1;
if(!fflag)flag=1,printf("%d %d %d\n",i*a,i*b,i*c);
}
if(!flag)printf("No!!!");
}
by qsceszthn @ 2020-07-31 19:12:21
而且你这个 数位分离 我怎么觉得怪怪的 取第2位应该是a / 10 % 10吧
by Zmr_ @ 2020-07-31 19:52:11
@gqh_蒟蒻_or_大佬 可以!orz