
基本算法----递归
文章平均质量分 68
神探小小迪
回头看,呀!这代码是我以前写的啊,写的是啥啊~
展开
-
递归
1、递归实现排列型枚举: 从 1~n 这n(n < 20)个整数中随机选取任意多个,输出所有可能的选择方案。 递归求解:这等价于每个整数可以选或者不选,所有可能的总数共有 2^n种。在每次递归中分别尝试某个数选或不选两条分支,将尚未确定的整数数量-1,从而转化为一个规模更小的同类问题。 代码: #include <iostream> #include <cstdi...原创 2018-08-19 23:09:14 · 228 阅读 · 0 评论 -
POJ 1845 Sumdiv【数论+递归+分治+快速幂】
Consider two natural numbers A and B. Let S be the sum of all natural divisors of A^B. Determine S modulo 9901 (the rest of the division of S by 9901). Input The only line contains the two natural n...原创 2018-08-20 21:36:46 · 228 阅读 · 0 评论