3 solutions

  • 1
    @ 2026-5-30 15:08:37

    #include<bits/stdc++.h> using namespace std; const int N=4,M=10; int a[N]; int cnt[M]; int main(){ int A,B,C,s=0; scanf("%d%d%d",&A,&B,&C); for(int i=1;iC<=987;i++){ memset(cnt,0,sizeof cnt); a[0]=iA,a[1]=iB,a[2]=iC; for(int j=0;j<=2;j++){ int k=a[j]; while(k){ cnt[k%10]++; k/=10; }

        }
        int j;
        for(j=1;j<=9;j++){
            if(cnt[j]!=1) break;
        }
        if(j==10) 
        {
            s=1;
            cout<<a[0]<<' '<<a[1]<<' '<<a[2]<<endl;
        }
        
    }
    if(s==0) cout<<"No!!!";
    return 0;
    

    }

    • 1
      @ 2026-5-30 15:05:14

      #include <bits/stdc++.h> using namespace std; int s[5],cnt[10]; int main(){ int a,b,c,f=0; scanf("%d%d%d",&a,&b,&c); for(int i=1,j=1;ic<=987;i++){ s[1]=ia,s[2]=ib,s[3]=ic; memset(cnt,0,sizeof cnt) ; for(j=1;j<=3;j++){ int t=s[j]; if(t>987 || t<123) break; cnt[t%10]++,cnt[t/10%10]++,cnt[t/100]++; } if(j!=4) continue; for(j=1;j<=9;j++) if(!cnt[j] || cnt[j]!=1) break;//没有出现或出现多次直接break if(j==10){ f=1; printf("%d %d %d\n",s[1],s[2],s[3]); } } if(!f) printf("No!!!") ; return 0; }

      • 1
        @ 2025-8-12 18:35:35
        #include<bits/stdc++.h>
        using namespace std;
        int main()
        {
        	int a,b,c;
        	cin>>a>>b>>c;
        	bool st=0; 
        	for(int i=1;i*c<=999;i++)
        	{
        		int t[]={0,i*a,i*b,i*c};
        		int w[15]={};//清空数组
        		int cnt=0;
        		for(int j=1;j<=3;j++)
        		{
        			int tt=t[j];
        			while(tt)
        			{
        				int ge=tt%10;
        				if(ge<=0) cnt=10;
        				if(w[ge]==0) cnt++;	
        				w[ge]++;
        				tt/=10;
        			}	
        		} 
        		if(cnt!=9) continue;//说明只要有一个数出现了两次
        		for(int j=1;j<=3;j++)
        		{
        			cout<<t[j]<<" ";
        		} 
        		st=1;
        		cout<<endl; 
        	}
        	if(st==0)
        	{
        		cout<<"No!!!";
        	}
        	return 0;
        }
        
        
        • 1

        Information

        ID
        2878
        Time
        1000ms
        Memory
        128MiB
        Difficulty
        3
        Tags
        # Submissions
        38
        Accepted
        11
        Uploaded By