摘要: 已知中前 求后序递归一下 有一些小细节 1 /* 2 ID: shangca2 3 LANG: C++ 4 TASK: heritage 5 */ 6 #include 7 #include 8 #include 9 #include10 #include11 using namespace std;12 char s1[30],s2[30];13 int o,kk;14 void order(int s,int e)15 {16 int i,k;17 if(s>=kk)18 return ;19 if(s>=e)20 ret... 阅读全文
posted @ 2013-08-21 21:40 _雨 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 这题水的真不易。。300多行 累死了 对着数据查错啊枚举每个边上的点到源点 是否中间隔着别的边 每条边划分500份就够了 注意一下与源点在一条直线上的边不算几何 啊,,好繁琐 参考各种模版。。 1 /* 2 ID: shangca2 3 LANG: C++ 4 TASK: fence4 5 */ 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 using namespace std; 13 typedef struct pointt 14 { 15 ... 阅读全文
posted @ 2013-08-21 20:32 _雨 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 刚开始理解有点误,想成每步都是最优的 ,结果卡在第六组数据上,,无奈瞧了下别人的 发现自己理解错了,,我看的还是中文翻译。。简单的记忆化 1 /* 2 ID: shangca2 3 LANG: C++ 4 TASK: game1 5 */ 6 #include 7 #include 8 #include 9 #include10 #include11 using namespace std;12 int a[210],dp[210][210],s[210];13 int find(int i,int j)14 {15 16 if(i==j)17 {1... 阅读全文
posted @ 2013-08-21 15:27 _雨 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 之前做过一道类似的 国际象棋盘神马的。。统计出以每个1作为右下角的最大正方形 那么以大于二到这个最大值之间为边的正方形都可以以这个为右下角 累加就可以了dp[i][j] = min(dp[i-1][j],dp[i-1][j-1],dp[i][j-1])+1; 1 /* 2 ID: shangca2 3 LANG: C++ 4 TASK: range 5 */ 6 #include 7 #include 8 #include 9 #include10 #include11 using namespace std;12 int dp[255][255],num[255]... 阅读全文
posted @ 2013-08-21 13:46 _雨 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 恶心的题啊 。。先枚举哪个点是所有人集合的点 再枚举所有骑士遇见国王的点 如果全部枚举出来会大大的TLE 经大牛验证 只需要枚举国王周围的点就可以了+-2 之内然后各种繁琐 各种错误 骑士有可能不带着国王一块走 也可能在他周围选个点带着走 先预处理出来每个骑士到国王周围的最短距离 然后再按上面的枚举就可以了考虑的不全面 。。错了好多个样例 样例2,6,19,20 都模拟了一遍。。还好错在小数据上 可以手算模拟一下 就知道哪错了 变量名都被我用穷了。。 1 /* 2 ID: shangca2 3 LANG: C++ 4 TASK: camelot 5 */ ... 阅读全文
posted @ 2013-08-21 13:02 _雨 阅读(267) 评论(0) 推荐(0) 编辑
摘要: 五维DP,听着挺多的,貌似就是挺裸的dp,最近貌似做简单的DP挺顺手。。1Adp[i][j][e][o][g] = min(dp[i][j][e][o][g],dp[i-i1][j-i2][e-i3][o-i4][g-i5]+p[q]) i1,i2...为满足给出的商品数量的值 p[q]为选用当前优惠方案的价格。 1 /* 2 ID: shangca2 3 LANG: C++ 4 TASK: shopping 5 */ 6 #include 7 #include 8 #include 9 #include10 #include11 using namespace s... 阅读全文
posted @ 2013-08-21 00:10 _雨 阅读(229) 评论(0) 推荐(0) 编辑