4 条题解

  • 1
    @ 2026-2-11 8:27:21
    #include<bits/stdc+.h> 
    using namespace std;
    int a , b , c , l , ll , lll , zt , ls=0 ,lz,lzz;/*
    int main(){
        cin>>a>>b>>c; 
        for(int i=1 00  ; i<=999 ; i++){
            int sz[15          ]={};
            ll=i;*/
     /*       if(ll%b==0 ){                /*
                l=ll/b*a;
                lll=ll/   b*c; 
                if(ll>99 || lll>999 || l>999){
                    continue ;
                }
                while*/(l >0){/*
                    sz[l%  10]=1;
                 } 
                ll=i;
                while(ll>0){
                    sz[ll%1 
                    0]=1;
                    ll/=10;
                //
          //      ll=i;
                l=ll/b*/*a;
                while(lll>0){
                   // sz[lll%10]=1ll;
                    ll   l/=10;(别抄浮木会没);
                }
                //lll      =l/a*c;
                zt=0   ;
                for(int i=1 ; i<=9 ; i++){
                    if(sz[i]==0){
                        zt=1;
                    }
                }
                if(zt==0){
                      lz=min(min(l , ll) , lll);
                         lzz=max(max(l , */ll) , lll);
                     cout<<lz<<' ' <<ll+lll+l-lz-lzz<< ''<<      lzz<<'\';
                    ls++;
                }
     
            }///
        }
        if(ls==0){
            cout<<"NO!!";
        }*/
        
    
    	retrn 0;
    }
    
    

    因为比例ABC中A能为0所以枚举B再求AC

    • 0
      @ 2026-2-13 10:10:05
      #include <bits/stdc++.h>
      using namespace std;
      bool check(int x, int y, int z) {
          bool used[10] = {false};
          while (x) {
              int d = x % 10;
              if (d == 0 || used[d]) return false;
              used[d] = true;
              x /= 10;
          }
          while (y) {
              int d = y % 10;
              if (d == 0 || used[d]) return false;
              used[d] = true;
              y /= 10;
          }
          while (z) {
              int d = z % 10;
              if (d == 0 || used[d]) return false;
              used[d] = true;
              z /= 10;
          }
          return true;
      }
      int main() {
          int A, B, C;
          cin >> A >> B >> C;
          bool found = false;
          for (int k = 1; k <= 999; k++) {
              int x = A * k;
              int y = B * k;
              int z = C * k;
              if (x > 999 || y > 999 || z > 999) break;
              if (x >= 100 && y >= 100 && z >= 100 && check(x, y, z)) {
                  cout << x << " " << y << " " << z << "\n";
                  found = true;
              }
          }
          if (!found) cout << "No!!!\n";
          return 0;
      }
      
      
      
      • 0
        @ 2026-2-13 10:09:32
        #include <bits/stdc++.h>
        using namespace std;
        int main() {
            int A, B, C;
            cin >> A >> B >> C;
            int a[9] = {1,2,3,4,5,6,7,8,9};
            bool found = false;
            do {
                int X = a[0]*100 + a[1]*10 + a[2];
                int Y = a[3]*100 + a[4]*10 + a[5];
                int Z = a[6]*100 + a[7]*10 + a[8];
                if (X * B == Y * A && X * C == Z * A) {
                    cout << X << " " << Y << " " << Z << '\n';
                    found = true;
                }
            } while (next_permutation(a, a + 9));
            if (!found) {
                cout << "No!!!" << endl;
            }
            return 0;
        }
        
        
        
        • 0
          @ 2026-2-10 16:00:01

          #include<bits/stdc++.h> using namespace std;

          int main(){ ios::sync_with_stdio(false); cin.tie(0);

          int A, B, C;
          cin >> A >> B >> C;
          
          bool found = false; 
          for(int i = 100; i <= 999; i++){
              if(i % A != 0) continue;
              int j = i * B / A;
              int k = i * C / A;
              if(j < 100 || j > 999 || k < 100 || k > 999) continue;
              if(i * B != j * A || i * C != k * A) continue;
              int u[10] = {0};
              bool v= true;
              int nums[3] = {i, j, k};
              for(int x = 0; x < 3; x++){
                  int num = nums[x];
                  while(num > 0){
                      int digit = num % 10;
                      if(digit == 0 || u[digit]){
                          v = false;
                          break;
                      }
                      u[digit] = 1;
                      num /= 10;
                  }
                  if(!v) break;
              }
              if(v){
                  for(int d = 1; d <= 9; d++){
                      if(!u[d]){
                          v = false;
                          break;
                      }
                  }
              }
              if(v){
                  cout << i << " " << j << " " << k << "\n";
                  found = true;
              }
          }
          if(!found){
              cout << "No!!!\n";
          }
          return 0;
          

          } 错了一个测试点

          • 1

          信息

          ID
          81
          时间
          1000ms
          内存
          256MiB
          难度
          2
          标签
          递交数
          67
          已通过
          11
          上传者