从a中选出b,一共有多少种选法

    xiaoxiao2025-08-24  68

    package cn.cx.my; public class Hello { public static void main(String[] args) throws Exception { System.out.println(f(5, 2)); } // 从a人中选出b人,一共有多少种选法 public static int f(int a, int b) { if (b > a) { return 0; } if (b == 0) { return 1; } return f(a - 1, b - 1) + f(a - 1, b); } }
    转载请注明原文地址: https://ju.6miu.com/read-1301983.html
    最新回复(0)