Bytelandian gold coins
来源:互联网 发布:三大耻辱 知乎 编辑:程序博客网 时间:2024/06/17 06:54
//http://www.spoj.com/problems/COINS/#include <iostream>#include <cstdlib>using namespace std;#define MEMOSIZE 1000000unsigned memo[MEMOSIZE];unsigned maxprofit(unsigned n) {unsigned s;if ((n<MEMOSIZE)&&memo[n]) return memo[n]-1;s=maxprofit(n/2)+maxprofit(n/3)+maxprofit(n/4);s=(s>n)?s:n;if(n<MEMOSIZE) memo[n]=s+1;return s;}int main(int argc, char* argv[]) {unsigned n;for(n=0; n<12; n++) memo[n]=n+1;while(scanf("%u", &n)==1) cout << maxprofit(n) << endl;}
0 0
- Bytelandian gold coins
- (codechef) Bytelandian gold coins
- codechef - Bytelandian gold coins 题解
- 【SPOJ-COINS】Bytelandian gold coins【DP】
- Gold Coins
- Gold Coins
- Gold Coins
- Gold Coins
- Gold Coins
- Gold Coins
- Gold Coins
- Gold Coins
- fjnu 1104 Gold Coins
- zoj 2345 Gold Coins
- POJ 2000 Gold Coins
- poj2000 Gold Coins!
- zoj 2345 Gold Coins
- ZOJ 2345 Gold Coins
- 编译原理学习笔记02——(对最基本文法的理解)——2014_1_12
- 针对DISCUZ!NT论坛的机器人一些方法
- VC模拟ping发送ICMP数据包
- C语言中大数的计算
- oracle第一天笔记
- Bytelandian gold coins
- Unity3D面试题汇总
- HDU4492
- @SuppressWarnings注解
- Log4j使用相对路径指定log文件及使用总结
- Spring 的事务处理
- UITableViewCell的标记、移动、删除、插入
- Windows CE下USB摄像头驱动开发(以OV511为例,附带全部源代码以及讲解) [转]
- LA3905