摘要: //设计一个支持大数运算的计算器,其中乘法使用分治法求解。该计算器支持加减乘除还有开方根运算。#include <iostream>#include <list>#include <string>#include <cstdio>#include <cctype>#include <cmath>using namespace std;list<char> Add(list<char> s, list<char> t);list<char> Sub(list<char&g 阅读全文
posted @ 2009-09-03 23:22 zhwj184 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 对于每一行 ,都要从某一位置分成两段 ,由于不能切出0长度的一段,所 以有n - 1个选择 ,一共m行 ,就是(n - 1)m种方案 。由于问题的规模很 小 ,暴力枚举所有情况取最优解就可以了。直接用dfs即可。#include <iostream>#include <cstdlib>#include <string>#include <cctype>using namespace std;const int MAXSIZE = 8;long nutrition[MAXSIZE][MAXSIZE];int m, n;long mindiff = 阅读全文
posted @ 2009-09-03 22:16 zhwj184 阅读(134) 评论(0) 推荐(0) 编辑