danaqi_ @ 2024-03-05 19:30:45
rt 请大佬帮忙看看那些地方出了问题
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;
int sum;
int main(){
int x,y,z,a,b,c,j,k,l,A,B,C;
scanf("%d%d%d",&A,&B,&C);
for(int i=123;i<=999;++i){
x=i/100;
y=i/10%10;
z=i%10;
a=i*2/100;
b=i*2/10%10;
c=i*2%10;
j=i*3/100;
k=i*3/10%10;
l=i*3%10;
if(x+y+z+a+b+c+j+k+l==1+2+3+4+5+6+7+8+9&&x*y*z*a*b*c*j*k*l==A*B*C*(A*2)*(B*2)*(C*2)*(A*3)*(B*3)*(C*3)){
printf("%d %d %d\n",i*A,i*B,i*C);
++sum;
}
}
if(sum==0)
printf("No!!!");
return 0;
}
by Ravener @ 2024-03-05 20:35:34
前面
by danaqi_ @ 2024-03-06 18:12:38
@Ravener
emmmmm 那该怎么办呢
by danaqi_ @ 2024-03-06 18:17:19
@Ravener
不对啊 前面的为什么是固定的?
by Ravener @ 2024-03-06 19:36:12
依题意,
by danaqi_ @ 2024-03-09 10:01:27
@Ravener
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;
int sum;
int main(){
int x,y,z,a,b,c,j,k,l,A,B,C;
//freopen("三连击(升级).in","r",stdin);
//freopen("三连击(升级).out","w",stdout);
scanf("%d%d%d",&A,&B,&C);
for(int i=123;i<=999;++i){
x=i/100;
y=i/10%10;
z=i%10;
a=i*2/100;
b=i*2/10%10;
c=i*2%10;
j=i*3/100;
k=i*3/10%10;
l=i*3%10;
if(x+y+z+a+b+c+j+k+l==1+2+3+4+5+6+7+8+9&&x*y*z*a*b*c*j*k*l==1*2*3*4*5*6*7*8*9){
printf("%d %d %d\n",i*A,i*B,i*C);
++sum;
}
}
if(sum==0)
printf("No!!!");
//fclose(stdin);
//fclose(stdout);
return 0;
}
我就是因为这样做得了20分 才那样做的
by Ravener @ 2024-03-10 21:36:29
你定义
是不是应该改成这样
x=i*A/100;
y=i*A/10%10;
z=i*A%10;
a=i*B/100;
b=i*B/10%10;
c=i*B%10;
j=i*C/100;
k=i*C/10%10;
l=i*C%10;
by Ravener @ 2024-03-10 21:50:25
你下面那个代码改了之后能拿80分
剩下的20分需要特判
(话说这玩意能撤回吗
by Ravener @ 2024-03-10 21:51:06
@danaqi_
by danaqi_ @ 2024-03-11 19:29:21
@Ravener
谢谢 终于改对了