import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter the number of second: "); int countDown = input.nextInt(); input.close(); long startTime =…
43. 投 n 个骰子,计算点数和出现的概率 递归求解:(空间 O(5*n+1),时间 O(6n)) void count(int N, int curN, int sum, int record[]) { if(curN == 0){ ++record[sum - N]; return;} for(int i = 1; i <= 6; ++i) count(N, curN-1, sum+i, record); } void occursNumber(int N, int record[])…