标签:示例 问题 adl cep line amr algo log void
示例代码:
1 import java.io.BufferedReader; 2 import java.io.IOException; 3 import java.io.InputStreamReader; 4 5 public class Main { 6 public static void main(String[] args) throws IOException{ 7 BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 8 String[] str = br.readLine().split(" "); 9 int m = Integer.parseInt(str[0]); 10 int n = Integer.parseInt(str[1]); 11 12 int coefficient = binomialCoe(m,n); 13 14 System.out.println(coefficient); 15 } 16 17 private static int binomialCoe(int k, int n) { 18 if( k == 0 || k ==n) 19 return 1; 20 return binomialCoe( k , n-1 ) + binomialCoe( k-1 , n-1 ); 21 } 22 }
蓝桥杯 算法训练 ALGO-150 6-1 递归求二项式系数值
标签:示例 问题 adl cep line amr algo log void
原文地址:http://www.cnblogs.com/cao-lei/p/6690302.html