Blue Bridge Cup javaB group - Minato formula


Minato formula

The DEF B
A + ------- + --- = 10
C GHI

(a problem if the display, can see FIG 1.jpg [])


in this equation represents the number of A ~ I 1 to 9, different letters represent different numbers.

For example:
6 + 8/3 + 952/714 is a kind of solution,
5 + 3/1 + 972/486 is another solution.

This formula a total of how many kinds of solution?

Note: You should submit is an integer, do not fill in any extra content or descriptive text.

/ ** 
 * @author remainder are red 
 * 6 December 2019   
 * / 
Package Penalty for Blue Bridge Cup Exams; 

Import java.util.concurrent.CountDownLatch; 

public  class Minato formula 
{ 

    / ** 
     * @param args
      * / 
    static  int [] Art 1,2,3,4,5,6,7,8,9 {= };
     static  int [] = BRT new new  int [. 9 ]; 

    public  static  int   COUNT = 0 ;
     public  static  void Print () // output 
    {
         for(int i=0;i<9;i++)
        {
            System.out.print(art[i]+" ");
        }
        System.out.println();
    }
    
    public static void sum()
    {
        int a = art[0];
        int b = art[1];
        int c = art[2];
        int def = art[3]*100+art[4]*10+art[5];
        int ghi = art[6]*100+art[7]*10+art[8];
        double sum = (double)a+((double)(b*ghi+c*def))/(c*ghi);//Common denominator 
        IF (SUM == 10.0 ) 
        { 
            Print (); // output satisfies the condition equation 
            COUNT ++ ; 
        } 
    } 
    
    public  static  void the swap ( int size) // full array 
    {
         IF (size == 0 ) 
        { 
            SUM () ; 
            return ; 
        } 
        the else {
             for ( int I = 0; I <= size; I ++ ) 
            { 
                int T = Art [I]; 
                Art [I] =art[size];
                art[size] = t;
                swap(size-1);
                t = art[i];
                art[i] = art[size];
                art[size] = t;
                
            }
        }
    }
    
    public static void main(String[] args)
    {
        // TODO Auto-generated method stub
        swap(8);
        //print();
    }

}

 

Guess you like

Origin www.cnblogs.com/zkw123/p/11997398.html