递归解决组合问题

比如从5个当中选2个

import java.util.Scanner;


/**
 * Created by junyi.pc on 2017/1/25.
 */

public class Main {


    public static int f(int n,int m){
              if(n

运行结果


C:\java\jdk1.8.0_25\bin\java -Didea.launcher.port=7533 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\java\jdk1.8.0_25\jre\lib\charsets.jar;C:\java\jdk1.8.0_25\jre\lib\deploy.jar;C:\java\jdk1.8.0_25\jre\lib\ext\access-bridge-64.jar;C:\java\jdk1.8.0_25\jre\lib\ext\cldrdata.jar;C:\java\jdk1.8.0_25\jre\lib\ext\dnsns.jar;C:\java\jdk1.8.0_25\jre\lib\ext\jaccess.jar;C:\java\jdk1.8.0_25\jre\lib\ext\jfxrt.jar;C:\java\jdk1.8.0_25\jre\lib\ext\localedata.jar;C:\java\jdk1.8.0_25\jre\lib\ext\nashorn.jar;C:\java\jdk1.8.0_25\jre\lib\ext\sunec.jar;C:\java\jdk1.8.0_25\jre\lib\ext\sunjce_provider.jar;C:\java\jdk1.8.0_25\jre\lib\ext\sunmscapi.jar;C:\java\jdk1.8.0_25\jre\lib\ext\sunpkcs11.jar;C:\java\jdk1.8.0_25\jre\lib\ext\zipfs.jar;C:\java\jdk1.8.0_25\jre\lib\javaws.jar;C:\java\jdk1.8.0_25\jre\lib\jce.jar;C:\java\jdk1.8.0_25\jre\lib\jfr.jar;C:\java\jdk1.8.0_25\jre\lib\jfxswt.jar;C:\java\jdk1.8.0_25\jre\lib\jsse.jar;C:\java\jdk1.8.0_25\jre\lib\management-agent.jar;C:\java\jdk1.8.0_25\jre\lib\plugin.jar;C:\java\jdk1.8.0_25\jre\lib\resources.jar;C:\java\jdk1.8.0_25\jre\lib\rt.jar;C:\Users\junyi.pc\Desktop\client\out\production\client;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.1\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain Main
10
Process finished with exit code 0


你可能感兴趣的:(递归解决组合问题)