伤感

P1618 三连击(升级版)

I_AM_THREE_BODY_MAN @ 2024-05-28 12:29:59

为什么60分

#include<bits/stdc++.h>
using namespace std;
int v,w[10],n,j,k;
double a,b,c,s,x;
bool f;
int main(){
    cin>>a>>b>>c;
    s=b/a;
    x=c/a;
    for(int i=1;i<333;i++){
        j=i*s;
        k=i*x;
        n=0;
        memset(w,0,sizeof(w));
        w[i/100]=1;w[i/10%10]=1;w[i%10]=1;
        w[j/100]=1;w[j/10%10]=1;w[j%10]=1;
        w[k/100]=1;w[k/10%10]=1;w[k%10]=1;
        for(int t=1;t<10;t++) n=w[t]+n;
        if(n==9){
            cout<<i<<" "<<j<<" "<<k<<endl;
            f=false;
        }
    }
    if(f) cout<<"No!!!";
    return 0;
}

by kongjunwen @ 2024-05-29 19:28:49

和我一样,我也是60

#include <iostream>
using namespace std;
int main()
{
    int a1,b1,c1;
    bool shi=true;
    cin >> a1 >> b1 >> c1; 
    for(int i = 123;i <= 999;i ++)
    {
        int z[15]={},a=i*a1,b=i*b1,c=i*c1;
        while(a)
        {
            z[a%10]++;
            a/=10;
        }
        while(b)
        {
            z[b%10]++;
            b/=10;
        }
        while(c)
        {
            z[c%10]++;
            c/=10;
        }
        bool f=true;
        for(int j = 1;j <= 9;j ++)
        {
            if(z[j]!=1)
            {
                f=false;
            }
        }
        if(f)
        {
            cout << i*a1 << " " <<i*b1 << " " << i*c1 << endl;
            shi=false; 
        }
    }
    if(shi)
    {
        cout << "No!!!";
    }
    return 0;
}

by I_AM_THREE_BODY_MAN @ 2024-08-06 16:56:03

@kongjunwen 同道中人


|