import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class Sf1 {
    public static void main(String[] args) {
        final int ts = 2;

        List<List<Fa>> fas = new ArrayList<List<Fa>>();
        for (int i = 0; i < ts; i++) {
            List<List<Fa>> cp = copy(fas);
            init(fas, Fa.FA1);
            init(cp, Fa.FA2);
            fas.addAll(cp);
        }
        fas.sort((a, b) -> (int) (100 * (fa(a) - fa(b))));
        System.out.println("最低:"+fa(fas.get(0)) + "-" + fas.get(0));
        System.out.println("最高:"+fa(fas.get(fas.size() - 1))+"-"+fas.get(fas.size() - 1));
    }

    static void init(List<List<Fa>> fas, Fa fa) {
        if (fas.isEmpty()) {
            List<Fa> fal = new ArrayList<Fa>();
            fal.add(fa);
            fas.add(fal);
        } else {
            fas.forEach(fai -> {
                fai.add(fa);
            });
        }
    }

    static List<List<Fa>> copy(List<List<Fa>> fas) {
        return fas.stream().map(ArrayList::new).collect(Collectors.toList());
    }

    static double fa(List<Fa> faList) {
        double dtf = 0;
        double gjf = 0;
        final double[] dtp1 = {100, .8};
        final double[] dtp2 = {150, .5};
        final double[] dtp3 = {400, 1};
        for (Fa fa : faList) {
            if (dtf <= dtp1[0] || dtf > dtp3[0]) {
                dtf += fa.ditie;
            } else if (dtf <= dtp2[0]) {
                dtf += fa.ditie * dtp1[1];
            } else {
                dtf += fa.ditie * dtp2[1];
            }
            gjf += fa.gongjiao;
        }
        return dtf + gjf;
    }

    enum Fa {
        /**
         * 方案1 地铁4,公交2 方案2 地铁6,公交1
         */
        FA1(4, 2), FA2(6, 1);
        private double ditie;
        private double gongjiao;

        @Override
        public String toString() {
            return "{d:" + ditie + ",g:" + gongjiao + "}";
        }

        Fa(int ditie, int gongjiao) {
            this.ditie = ditie;
            this.gongjiao = gongjiao;
        }
    }

}
feir(Non Is Every) - 2020-07-01 0 人
计算单位天数内北京地铁坐车方案最贵和最便宜方案
class Main {
	package homework1

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

public class TcpClient {
       
         public static void main(String[] args) throws IOException {
         Socket socket = new Socket(host:"127.0.0.1",port:7777);
         OutputSream os = socket.getOutputSream();
         InputStream is = socket.getInputSream();
         Scanner sc = new Scanner(System.in);
         String msg;
         do {
                   System.out.print("客户端:");
                   msg = sc.next();
                   os.write(msg.getBytes());
                   byte[]  byte = new byte[1024];
                   int len = is.read(bytes);
                   System.out.println("服务器端:" + new String(bytes, offest:0, len));
           }while((msg.equals("退出"))  != true);
          socket.close();
          }
}
}
steinonoobie(Toaru_Sucial()) - 2020-06-30 0 人
聊天小工具。
class Main {
	package homework1

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

public class TcpClient {
       
         public static void main(String[] args) throws IOException {
         Socket socket = new Socket(host:"127.0.0.1",port:7777);
         OutputSream os = socket.getOutputSream();
         InputStream is = socket.getInputSream();
         Scanner sc = new Scanner(System.in);
         String msg;
         do {
                   System.out.print("客户端:");
                   msg = sc.next();
                   os.write(msg.getBytes());
                   byte[]  byte = new byte[1024];
                   int len = is.read(bytes);
                   System.out.println("服务器端:" + new String(bytes, offest:0, len));
           }while((msg.equals("退出"))  != true);
          socket.close();
          }
}
}
13062332492(SCANF) - 2020-06-25 0 人
聊天小工具。
class Main {
	public static void main(String[] args) {
		//String res = "Hello 2222!";
		byte[] test = {1,5,'b'};
        //System.out.println(Arrays.toString(test));
        //String pp = bytes2Hex(test);
		//String pp = new String(test,"UTF-8");
        

        byte[] k2 = {'a','b','c','d'};

        byte b = 35;
        String s=Byte.toString(b); 
        String s=b + ""; 
        System.out.println(s);

        //String ss=new String(new byte[] {b});
        //System.out.println(ss);
	}

    //将bytes[] 转换为String
    // public static String bytes2Hex(byte[] src) {
    //     if (src == null || src.length <= 0) { 
    //     return null; 
    //     } 
        
    //     char[] res = new char[src.length * 2]; // 每个byte对应两个字符
    //     final char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
    //     for (int i = 0, j = 0; i < src.length; i++) {
    //     res[j++] = hexDigits[src[i] >> 4 & 0x0f]; // 先存byte的高4位
    //     res[j++] = hexDigits[src[i] & 0x0f]; // 再存byte的低4位
    //     }
        
    //     return new String(res);
    // }


}
dolami(最强时间管理达人~) - 2020-06-20 0 人
日常测试代码
class Main {
	public static void main(String[] args) {  
        for(TestEnum e:TestEnum.values()){
            System.out.println(e.getName());
        }
	}
}

enum TestEnum { 
    C(1, "c"),
    GO(2, "go"),
    CPP(3, "cpp"),
    GROOVY(4, "groovy"), 
    FSHARP(5, "fsharp") ,
    VB(6, "vb") ,
    SWIFT(7, "swift") ,
    DART(8, "dart") ,
    R(9, "r") ,
    CLOJURE(10, "clojure") ,
    KOTLIN(11, "kotlin") ,
    RUST(12, "rust") ,
    PASCAL(13, "pascal") ,
    PERL(14, "perl") , 
    ;

    private String name;
    private int code;

    TestEnum(int code, String name) {
        this.name = name;
        this.code = code;
    }
  
    public String getName() {
        return name;
    }

    public int getCode() {
        return code;
    }
}
lohiecan(程独秀) - 2020-06-19 1 人
java enum枚举遍历
class Main {
	public static void main(String[] args) {
        int i=1;
        int j=i++;
        if((i==(++j))&&(i++)==j){
            i+=j;
        }
      System.out.println("i="+i);  
	}
}
arison(潜龙在渊) - 2020-06-16 0 人
Java初级测试题目(1)
没有了
1/49 下一页