一次格子取数的问题
2014-03-06 10:29
162 查看
#include <stdio.h> #include <stdlib.h> int geZiQuShu(int num[][4], int h, int l){ int up, left; if(h < 0 || l < 0) return 0; if(h == 0 && l == 0) return num[0][0]; up = geZiQuShu(num, h - 1, l); left = geZiQuShu(num, h, l - 1); if(up > left){ return up + num[h][l]; } else{ return left + num[h][l];; } } main(){ int num[4][4] = {20, 20, 20, 4, 5, 6, 20, 8, 9, 10, 20, 12, 13, 14, 20, 20}; int result; result = geZiQuShu(num, 3, 3); printf("%d \n", result); }
相关文章推荐
- App Store idfa被拒检查办法
- windows 常用命令不完全总结
- C# WinForm中PreviewKeyDown、KeyDown、KeyPress、KeyUp区别与联系
- linux下用arm-none-linux-gnueabi交叉编译arm内核模块
- SEO优化的一些细节问题
- 告白,一种优雅的伤
- 老站长如何运用锚文本来进行站内优化
- C# WinForm中PreviewKeyDown、KeyDown、KeyPress、KeyUp区别与联系
- 数值整数次方
- 程序员技术练级攻略
- String、StringBuffer和StringBuilder的区别
- x86/x86_64 CPU中PCI Express扩展配置空间访问
- 如何使用mx:RemoteObject
- 3110 [Zjoi2013]K大数查询
- Android那些事儿之自定义进度条
- 个人经验总结:MySQL数据库优化技巧集锦
- C#验证格式收藏
- 运算符的顺序
- 数据结构基础(4)————next数组的理解
- jquery IE6 下animate 动画的opacity无效