摘要: During each move the player can chooseall lines of the matrix where dwarf is not on the cell with candyand shout "Let's go!"这个 看成是 选其所有干行 我却看成是选其中 若干 行 水一下自己#include #include #include #include using namespace std;char map[1005][1005];int N[1005],L[1005];int main(){ int n,m; while(scanf 阅读全文
posted @ 2014-03-08 11:22 来自大山深处的菜鸟 阅读(147) 评论(0) 推荐(0)
摘要: /* 题目是 有一个 m*n 的矩阵然后矩阵中的每个点有个权值 你从 第一列走到最后一列 然后输出最小权值的 路径 和最小权值,来个 倒的 dp[i][j]=min(dp[i+1][j+1],dp[i][j+1],dp[i-1][j+1])+w[i][j]*/#include #include #include using namespace std;int turn[11][3];int map[15][105],dp[15][105];int path[15][105];int main(){ int n,m,i,j,k; while(scanf("%d%d",& 阅读全文
posted @ 2014-03-07 10:11 来自大山深处的菜鸟 阅读(158) 评论(0) 推荐(0)
摘要: /*2014.3.6 这题说的是给你了一根木棒 然后 n 个点(线段上的点) 然后计算 在这 n个点上都切下去的 最小花费 举个例子 100 3 25 50 75 如果 从 25 开始切 然后切 50 75 则花费是 100 + 75 +50= 225 如果 从 50 开始切 然后切 25 75 则花费 100 +50 +50 =200 相对 更优一些 解题: 可以发现 当 从某个点坐标为 D 切下去后则从0到D的 部分和从 D到 I 的 部分就没有了关系 因此 得到状态转移的 公式 dp[i][j]=min(dp[i][k]+dp[k][j... 阅读全文
posted @ 2014-03-06 18:11 来自大山深处的菜鸟 阅读(219) 评论(0) 推荐(0)
摘要: /* 坑了 把 重载的#include#include#includeusing namespace std;struct word{ char str[205]; bool operator ='A'&&str[i]='a'&&str[i]='a'&&str[i]<='z'&&i<L){ T[num].str[Len++]=str[i]; i++; } num++; }else i++; } sort(T,T+num); printf("%s\ 阅读全文
posted @ 2014-03-05 20:58 来自大山深处的菜鸟 阅读(329) 评论(0) 推荐(0)
摘要: /* 水题 体现出题目看不懂 额 */#include #include #include #include using namespace std;const int maxn=55;struct card{ char A,B; card(char a=0,char b=0){ A=a;B=b; } bool operator == (const card F){ if(A==F.A||B==F.B) return true; else return false; }};struct stac{ card T[maxn]; int t; void sclea... 阅读全文
posted @ 2014-03-05 15:32 来自大山深处的菜鸟 阅读(135) 评论(0) 推荐(0)
摘要: /* 这题相对比较水 算 用5面值的 货币拼成 固定的面值的 有多少种方法*/#include #include #include using namespace std;long long dp[10000];int C[]={50,25,10,5,1};int main(){ int N; while(scanf("%d",&N)==1){ memset(dp,0,sizeof(dp)); dp[0]=1; for(int i=0;i<5;i++) for(int j=C[i];j<=N;j++) ... 阅读全文
posted @ 2014-03-05 14:21 来自大山深处的菜鸟 阅读(167) 评论(0) 推荐(0)
摘要: /* 题目的大意是 给你 N 学生 然后 给前 K个学生编号了 给定的 号码 , 然后你按照 使得接下来学生 学号尽量小的 方法 从第 K+1个学生开始编号 每个号码 自然只能用一次, 解答 : 先将编好的号码排好序,排完后 记录他们之间的 空格数,进行二分查找 有三种情况 1、学生就在 1至K中 2、学生在 K+1 到 D(K个学生中编号最大的那个数) 3、学生在D以后 1、3 都很好求, 对于第二种计算 他距离 第K个 学生都少位 ,然后再 之前算好的空格中 安排他 我为何如此的弱 想了 一天... 阅读全文
posted @ 2014-03-04 22:45 来自大山深处的菜鸟 阅读(168) 评论(0) 推荐(0)
摘要: /* 通过这题 学会了 两个词组 immediately to the left 是左邻的意思 immediately to the right 这个是右邻的意思*/#include #include#includeusing namespace std;const int maxn=50;int N[2][maxn];int DNA[10];char str[]={' ','.','x','W'};int main(){ int t; scanf("%d",&t); while(t--){ for(i 阅读全文
posted @ 2014-03-03 16:39 来自大山深处的菜鸟 阅读(166) 评论(0) 推荐(0)
摘要: /* 最长 公共子序列 记得用 gets(); 用scanf坑了一次*/#include #include #include using namespace std;const int maxn=1005;char str[2][maxn];int N[2][maxn];int main(){ while(gets(str[0])){ gets(str[1]); int n=strlen(str[0]); int m=strlen(str[1]); memset(N,0,sizeof(N)); int d=0; ... 阅读全文
posted @ 2014-03-02 15:06 来自大山深处的菜鸟 阅读(121) 评论(0) 推荐(0)
摘要: /* 这题说的的是 N 维的坐标, 每个盒子的N维坐标 可以进行 随意方式的调换 然后求出 A全部的坐标小于B的 则 A 可以嵌套在B中 然后 计算出最多的 盒子嵌套个数 简单的状态转移 我为何如此的弱*/#include #include #include #include #include #include #include using namespace std;const int maxn=35;const int maxm=15;int N[maxn][maxm];int dp[maxn];int lis,mlis,n,m,per[maxn];bool mark[maxn][... 阅读全文
posted @ 2014-03-02 14:43 来自大山深处的菜鸟 阅读(154) 评论(0) 推荐(0)