05 2012 档案
递归的现实应用
摘要:问设有50个台阶的楼梯, 若一个人上楼梯跨出一步有三种迈法:一次上1个台阶, 一次上2个台阶, 一次上3个台阶。 问总共有多少种不同的上楼方式?考虑他迈最后一步的情况, 即最后一步上了1个台阶, 也可能上了2个台阶, 也可能上了3个台阶。Last step=1 -> 前边有(50-1) 个台阶-> 49个台阶有多少种上楼方式Last step=2 -> 前边有(50-2) 个台阶 -> 48个台阶有多少种上楼方式Last step=3 -> 前边有(50-3) 个台阶 -> 47个台阶有多少种上楼方式所以, 50个台阶情况=49个台阶的情况+48个台阶的情况
阅读全文
Josephus 问题
摘要:Josephus Problem C#实现:usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespaceJosephus{classProgram{staticvoidMain(string[]args){JosephusOutput(-11,10);}staticvoidJosephusOutput(intM,intN){//Inputvalidationcheckif(M<0||N<0)return;//InitializethesequenceJosephusDa
阅读全文
均匀设计U Star 665
摘要:均匀设计U Star 6行5列, 标准数位6Current Column Values Are: 2 3 4 5 6 1 2 3 4 5 6 2 4 6 1 3 5 3 6 2 5 1 4 4 1 5 2 6 3 5 3 1 6 4 2 6 5 4 3 2 1 我最喜欢的一组数:Current Column Values Are: 1 3 4 5 6 1 1 3 4 5 6 2 2 6 1 3 5 3 3 2 5 1 4 4 4 5 2 6 3 5 5 1 6 4 2 6 6 4 3 2 1 Current Column Values Are: 1 2 4 5 6 1 1 2 4 5 6 2
阅读全文
浙公网安备 33010602011771号