摘要: 爬楼梯求最大分数如下图,最大分数是: 10+20+25+20=75. 要求:1、每次只能走一步或者两步;2、不能连续三步走一样的,即最多连续走两次一步,或者连续走两次两步;3、必须走到最后一层台阶。代码:#include #include #include using namespace std;#... 阅读全文
posted @ 2015-09-07 14:09 蚂蚁吃大象、 阅读(550) 评论(0) 推荐(0) 编辑
摘要: 求出A到B的最小步数给定象棋盘,以及位置A和B, 求出从A到B的最小步数Input 2 -->case 个数9 9 -->棋盘大小3 5 2 8 --> 起始位置20 202 3 7 9Output25代码:#include #include #include using namespac... 阅读全文
posted @ 2015-09-07 11:20 蚂蚁吃大象、 阅读(482) 评论(0) 推荐(0) 编辑
摘要: 求N以内的真分数个数For example, if N = 5, the number of possible irreducible fractions are 11 as below.0 1/5 1/4 1/3 2/5 1/2 3/5 2/3 3/4 4/5 1 Input1 --> case ... 阅读全文
posted @ 2015-09-07 11:07 蚂蚁吃大象、 阅读(187) 评论(0) 推荐(0) 编辑