上一页 1 ··· 34 35 36 37 38 39 40 41 42 ··· 71 下一页
摘要: 忘记pick定理是什么了 想枚举来着 。。没枚出来有篇pick定理的证明 貌似挺好 也没太看懂 1 /* 2 ID: shangca2 3 LANG: C++ 4 TASK: fence9 5 */ 6 #include 7 #include 8 #include 9 #include10 #include11 using namespace std;12 int gcd(int x,int y)13 {14 return y==0?x:gcd(y,x%y);15 }16 int main()17 {18 freopen("fence9.in","r... 阅读全文
posted @ 2013-08-22 11:00 _雨 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 已知中前 求后序递归一下 有一些小细节 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) 编辑
摘要: 都忘了欧拉路径是什么了。。用dfs搜 标记边 刚开始直接从I-N搜 直接超时 2了 先找符合起点和终点的点搜 即度数是奇数d单dfs也超了 后来换了个姿势。。 1 /* 2 ID: shangca2 3 LANG: C++ 4 TASK: fence 5 */ 6 #include 7 #include 8 #include 9 #include10 #include11 using namespace std;12 int w[510][510],n,p[2010],flag,m,de[510],t;13 void dfs(int u,int d)14 {15 ... 阅读全文
posted @ 2013-08-20 21:59 _雨 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 直接枚举角度 数据比较水吧 1 /* 2 ID: shangca2 3 LANG: C++ 4 TASK: spin 5 */ 6 #include 7 #include 8 #include 9 #include10 #include11 using namespace std;12 struct node13 {14 int l[10],r[10],k,v;15 }p[10];16 int f[6][370];17 int main()18 {19 freopen("spin.in","r",stdin);20 freopen("spin. 阅读全文
posted @ 2013-08-20 20:33 _雨 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 最短路复杂度估计错误 以为SPFA是N*m的 用了dij超时 用SPFA直接跑就好了O(k*e) K 一般为2,3; 1 /* 2 ID: shangca2 3 LANG: C++ 4 TASK: butter 5 */ 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 using namespace std; 13 #define M 1500 14 #define P 850 15 #define N 550 16 #define INF 0xfffff... 阅读全文
posted @ 2013-08-20 19:42 _雨 阅读(241) 评论(0) 推荐(0) 编辑
上一页 1 ··· 34 35 36 37 38 39 40 41 42 ··· 71 下一页