首页 > 学院 > 开发设计 > 正文

24点算法的java代码

2019-11-18 11:00:24
字体:
来源:转载
供稿:网友
  
/*我编的小程序,逻辑有点混乱,注释也少得可怜,但应该能列出任何能用四则运算得出24的四个1~10的数的等于24的等式。
大家若有空,请指点。*/
public class Test24Point{
    public static void main(String[] args){
     int index = 0 ;
     int temp = 0 ;
     int totalSUC = 0 ;
     
     int numb[] = new int[4];//the first four numbers
     double num[][] = new double[36][3];//three numbers after calculating
     double total[] = new double[6];//the number after three steps of calculating
     
     
     
     double p[][] = new double[6][8];
     double q[][] = new double[3][7];
     
     
     
     //System.out.PRintln(2465%108);
     //System.out.println(2465/108);
     
     System.out.println("/"a--b/"means/"b-a/"");
     System.out.println("/"a//b/"means/"b/a/"/n");
     
    /* for(int h = 0; h <= 9; h ++)//Get the first four numbers for calculating and store into the array numb[4];.
      for(int i = 0; i <= 9; i ++)
       for(int j = 0; j <= 9; j ++)
        for(int k = 0; k <= 9; k ++){
         numb[0] = h ;
         numb[1] = i ;
         numb[2] = j ;
         numb[3] = k ; 
        }*/
  for(int i = 0 ; i < 4 ; i ++){

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表