摘要: 一个简单而经典的dp;若数组a:1 3 2 4则数组b:1 4 3 8b[i]每一个都要向前找 合法 的最大b[x]值加上当前的a[i];如b[2]=b[0]+a[2];#include using namespace std;int a[1001];int b[1001];int max_b(in... 阅读全文
posted @ 2014-07-16 22:15 Mr.XuJH 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 题目是数独,想到了深度优先搜索一个个地验证;做出来后,妈妈再也不用担心我玩数独被人虐了#include using namespace std;int num[10][10];int x,y;bool judge(int l,int r,int a){ //用于判断同一行,... 阅读全文
posted @ 2014-07-16 16:06 Mr.XuJH 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 这一题用了DFS对每一种方法进行尝试,直到有一种成功的就possible;#include #include "string.h"using namespace std;int diff;int card[26][4]; //用于记录不同卡片的上、右、下、左、方向的数字int ca... 阅读全文
posted @ 2014-07-16 10:55 Mr.XuJH 阅读(163) 评论(0) 推荐(0) 编辑