求助julao,我哪里错了

P1618 三连击(升级版)

迪哥铁粉002 @ 2019-08-15 09:38:48

#include<iostream>
using namespace std;
int fc (int h,int b,int c)
{
    int a[10]={0,0,0,0,0,0,0,0,0,0};
    a[h%10]++;a[h/10%10]++;a[h/100]++;
    a[b%10]++;a[b/10%10]++;a[b/100]++;
    a[c%10]++;a[c/10%10]++;a[c/100]++;
    if (a[1]==1&&a[2]==1&&a[3]==1&&a[4]==1&&a[5]==1&&a[6]==1&&a[7]==1&&a[8]==1&&a[9]==1&&a[10]==1) return 1;
    return 0;
}
int main()
{
    int a,b,c,sum=0;
    cin>>a>>b>>c;
    for (int i=100;i<=999;++i)
    {
        int j,k;
        if (i%a!=0) continue;
        j=i/a*b;
        k=i/a*c;
        if (j<=999&&k<=999&&fc(i,j,k)==1) 
        {
            cout<<i<<" "<<j<<" "<<k<<endl;
            sum=1;
        }
    }
    if (sum==0) cout<<"No!!!";
    return 0;
}

by 迪哥铁粉002 @ 2019-08-15 09:39:04

我已经下载不了数据了


by jason611 @ 2019-08-25 20:30:06

include<bits/stdc++.h>

using namespace std; int a,b,c,i,l[10],j,k,x,aa[10],mm; int main(){ cin>>a>>b>>c; for(i=1;i<=999a/c;i++){ mm=0; j=ib/a;k=i*c/a; l[1]=i/100; l[2]=i/10%10; l[3]=i%10; l[4]=j/100; l[5]=j/10%10; l[6]=j%10; l[7]=k/100; l[8]=k/10%10; l[9]=k%10;

for(i=1;i<=9;i++){
        aa[l[i]]++;
}
for(i=1;i<=9;i++){
    if(aa[i]!=1)mm=1;
}
if(mm==0)cout<<i<<j<<k;
}
return 0;

}


by jason611 @ 2019-08-25 20:30:41

include<bits/stdc++.h>

using namespace std; int a,b,c,i,l[10],j,k,x,aa[10],mm; int main(){ cin>>a>>b>>c; for(i=1;i<=999a/c;i++){ mm=0; j=ib/a;k=i*c/a; l[1]=i/100; l[2]=i/10%10; l[3]=i%10; l[4]=j/100; l[5]=j/10%10; l[6]=j%10; l[7]=k/100; l[8]=k/10%10; l[9]=k%10;

for(i=1;i<=9;i++){
        aa[l[i]]++;
}
for(i=1;i<=9;i++){
    if(aa[i]!=1)mm=1;
}
if(mm==0)cout<<i<<j<<k;
}
return 0;

}


|