摘要: 题目传送门:http://www.nocow.cn/index.php/Translate:USACO/range 这道题的话如果不是之前做过类似的题目,我想我是做不出来的,大概就是先预处理s[i][j],表示前i行前j列有多少个1,然后O(1)时间判断这个正方形是否有1。 s[i][j]显然等于是 阅读全文
posted @ 2016-03-17 23:13 Sun_Sea 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 题目传送门:http://www.nocow.cn/index.php/Translate:USACO/camelot 这道题让我心痛,一开始写写不出,后来拖了很久,决定去看题解,没想到又看不懂官方题解,唉!后来看了下面的题解做了出来。题解的话,大概就是先预处理每个格子到另外格子的位置,再枚举在王的 阅读全文
posted @ 2016-03-17 22:46 Sun_Sea 阅读(256) 评论(0) 推荐(0) 编辑
摘要: 题目传送门:http://poj.org/problem?id=2796 这道题的话我用了RMQ和二分。 思想:用minm来表示区间[L,R]的最小值,很明显一个区间[L,R]能取得的最大值,要么就是[L,minm-1],要么就是[minm+1,R],还有就是整个区间的和乘最小值。 因为对于某两个最 阅读全文
posted @ 2016-03-02 22:46 Sun_Sea 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 题目传送门:http://poj.org/problem?id=3264 这道题就是简单的求最大值求最小值。 #include<cstdio> #include<cstring> #include<iostream> using namespace std; const int maxn=50010 阅读全文
posted @ 2016-03-02 22:35 Sun_Sea 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 题目传送门:http://poj.org/problem?id=3368 题解传送门:http://www.cnblogs.com/frog112111/p/3306280.html 这道题我又看了题解(捂脸),题解大家看链接的吧。还有就是我的代码较拙,跑了1s多。。。。。。 #include<cs 阅读全文
posted @ 2016-02-23 23:06 Sun_Sea 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 题目传送门:http://www.nocow.cn/index.php/Translate:USACO/shopping 这道题我用dp做,把每一种优惠方案当作都有5件物品,没有的物品记为0,但写的很乱,所以直接看dp那里就好了 1 /* 2 ID:abc31261 3 LANG:C++ 4 TAS 阅读全文
posted @ 2016-01-27 15:24 Sun_Sea 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 题目传送门:http://www.nocow.cn/index.php/Translate:USACO/fence 这道题直接模拟就好了 /* ID:abc31261 LANG:C++ TASK:fence */ #include<cstdio> #include<cstring> #include 阅读全文
posted @ 2016-01-27 15:20 Sun_Sea 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 题目传送门:http://www.nocow.cn/index.php/Translate:USACO/msquare 这道题bfs+hash,但想到要判重的数字不多,就直接用了map,数组传递有些麻烦,所以直接写在了一起,会有点乱 /* ID:abc31261 LANG:C++ TASK:msqu 阅读全文
posted @ 2016-01-19 23:26 Sun_Sea 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 题目传送门:http://www.nocow.cn/index.php/Translate:USACO/ratios 这道题也是直接枚举。。。 /* ID:abc31261 LANG:C++ TASK:ratios */ #include<cstdio> #include<cstring> #inc 阅读全文
posted @ 2016-01-19 23:22 Sun_Sea 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 这道题直接枚举就好了,但我当时竟然没想到,我真是太失败了。。。。。Q_Q /* ID:abc31261 LANG:C++ TASK:spin */ #include<cstdio> #include<cstring> #include<iostream> using namespace std; c 阅读全文
posted @ 2016-01-19 23:13 Sun_Sea 阅读(195) 评论(0) 推荐(0) 编辑