个人记录
POJ1845 Sumdiv
递归+数学 题意:求A^B的所有约数之和mod 9901。 把A分解质因数,得A=p_1^c_1 × p_2^c_2 × ... × p_n^c_n; therefore A^B=p_1^B· c_1 × p_2^B· c_2 × ... × p_n^B· c_n。 theref…
83001
还没有收录这位用户的资料。
递归+数学 题意:求A^B的所有约数之和mod 9901。 把A分解质因数,得A=p_1^c_1 × p_2^c_2 × ... × p_n^c_n; therefore A^B=p_1^B· c_1 × p_2^B· c_2 × ... × p_n^B· c_n。 theref…
主要思路 递推,有n个盘时,移动分三步: (1)将i个盘利用四塔移动到第1~3个塔上; (2)将剩下的n-i个塔用三塔移动到第4个塔; (3)将第1~3个塔上i个盘利用四塔移动到第4个塔。 所以,我们用d_i代表有i个盘时三塔汉诺塔移动最少步数,有qquad d_1=1,d_i=…