2013年8月27日

Robots on a grid(DP+bfs())

摘要: 链接:http://www.bnuoj.com/bnuoj/problem_show.php?pid=25585Current Server Time:2013-08-27 20:42:26Robots on a gridTime Limit:3000msMemory Limit:65536KB64-bit integer IO format:%lld Java class name:MainPrevSubmitStatusStatisticsDiscussNextFont Size:+-Type:Tag it!You have recently made a grid traversing 阅读全文
posted @ 2013-08-27 20:52 ~~碾压机 阅读(331) 评论(0) 推荐(0) 编辑
2013年8月26日

Dividing a Chocolate(zoj 2705)

摘要: Dividing a Chocolate zoj 2705递推,找规律的题目:具体思路见:http://blog.csdn.net/u010770930/article/details/9769333 1 #include 2 #include 3 using namespace std; 4 int a[50]; 5 int main() 6 { 7 int i,j,maxx; 8 long long m,n; 9 a[0]=1;10 a[1]=1;11 while(~scanf("%lld%lld",&m,&n))12 {13 maxx=max(m,.. 阅读全文
posted @ 2013-08-26 21:40 ~~碾压机 阅读(183) 评论(0) 推荐(0) 编辑

Largest Rectangle in a Histogram(HDU1506)

摘要: Largest Rectangle in a Histogram HDU1506一道DP题:思路:http://blog.csdn.net/qiqijianglu/article/details/8556852 1 #include 2 #include 3 using namespace std; 4 int a[100005]; 5 int l[100005],r[100005]; 6 int main() 7 { 8 int n,i,j; 9 long long maxx,sum;10 while(~scanf("%d",&n)&&n)11 { 阅读全文
posted @ 2013-08-26 21:29 ~~碾压机 阅读(171) 评论(0) 推荐(0) 编辑
2013年8月25日

多重背包问题:悼念512汶川大地震遇难同胞——珍惜现在,感恩生活(HDU 2191)(二进制优化)

摘要: 悼念512汶川大地震遇难同胞——珍惜现在,感恩生活HDU 2191一道裸的多重背包问题: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int dp[10005],a[10005],b[10005],c[10005]; 7 int main() 8 { 9 int t,n,m;10 scanf("%d",&t);11 while(t--)12 {13 scanf("%d%d",&m,&n);14 for(int i=0;i=a[i];k-- 阅读全文
posted @ 2013-08-25 10:46 ~~碾压机 阅读(348) 评论(0) 推荐(0) 编辑

完全背包问题:湫湫系列故事――减肥记I(HDU 4508)

摘要: 湫湫系列故事――减肥记I HDU 4508一道裸的完全背包 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int c[100005],a[105],b[105]; 7 int main() 8 { 9 int n,i,j,m;10 while(scanf("%d",&n)!=EOF)11 {12 for(i=0;i 2 #include 3 #include 4 #include 5 using namespace std; 6 int c[100005],a[1... 阅读全文
posted @ 2013-08-25 10:20 ~~碾压机 阅读(166) 评论(0) 推荐(0) 编辑

01背包问题:Charm Bracelet (POJ 3624)(外加一个常数的优化)

摘要: Charm Bracelet POJ 3624就是一道典型的01背包问题: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int a[3405],b[3405]; 7 int c[12888]; 8 int main() 9 {10 int n,m,i,j;11 while(scanf("%d%d",&n,&m)!=EOF)12 {13 for(i=1;i=a[i];j--)18 if(c[j] 2 #include 3 #include ... 阅读全文
posted @ 2013-08-25 10:07 ~~碾压机 阅读(1141) 评论(0) 推荐(0) 编辑
2013年8月23日

计算几何基础与一般模板:POJ 3675&&ZOJ 1450&&POJ 1375

摘要: TelescopePOJ 3675一道模板题:这个模板太难打了,记住就行了吧。。。就是给你一个圆,求一个多边形在圆里的面积:分五种情况!!!因为任何多边形可以分成若干个三角形。。。那么就判断两点与圆心形成的三角形来求面积。。。参见:http://hi.baidu.com/billdu/item/703ad4e15d819db52f140b0b(五种情况,带图的哦!亲)接下来就是模板。。。转载于:http://gzhu-101majia.iteye.com/blog/1128345 1 //多边形与圆点相交面积 poj3675 2 #include 3 #include 4 #inc... 阅读全文
posted @ 2013-08-23 22:17 ~~碾压机 阅读(619) 评论(0) 推荐(0) 编辑

8月22号的练习:HDU 1196&&HDU 1673&&HDU 1269&&HDU 1841(KMP)&&HDU 1176(数塔问题)

摘要: Lowest BitHDU 1196非常水的题目:(不解释) 1 #include 2 #include 3 #include 4 using namespace std; 5 int main() 6 { 7 int n,d; 8 while(scanf("%d",&n)!=EOF&&n) 9 {10 d=0;11 while(1)12 {13 if(n%2==0)14 {15 d++;16 n=n/2;17 ... 阅读全文
posted @ 2013-08-23 20:11 ~~碾压机 阅读(200) 评论(0) 推荐(0) 编辑
2013年8月22日

8月21号的练习:POJ 1511&&HDU 1018&&HDU 2571&&HDU 1533&&HDU 2554

摘要: Invitation CardsPOJ 1511较水的题,可以说是一道模板题了。。。spfa+邻接表但是有几个注意的地方:1,题目给出的数据较大,只能用邻接表,并且要__int64的配合。2,题目要求来回的最短路,需要建立两个邻接表(反向可以了)。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 const __int64 max1=1000000005; 8 int vis[1000005],pre[1000005],pre1[1000005],t,d1; 9 _... 阅读全文
posted @ 2013-08-22 12:55 ~~碾压机 阅读(223) 评论(0) 推荐(0) 编辑
2013年8月21日

计算几何基础与应用:HDU 1348&&ZOJ 1648&&POJ 2398&&ZOJ 1010

摘要: 首先声明叉积在计算几何是基本用法!!他的奶名就叫做向量积!!(好熟悉的称呼)那么叉积主要注意方向问题:他是以前面的向量为起点转向另外那个向量的角度!!Wall HDU 1348一道模板题!!(凸包问题)三步骤:排序,再排序,再是重点进行判断!!!先进行排序,从小到大找出最左下角的一个坐标!之后以这个坐标找出每个点的极角(用个三角公式atan2(y,x))之后以三点为核心进行判断!!!如果第三点在前两点连线的左边可以,不然回溯再进行判断!!具体参见:http://hi.baidu.com/nicker2010/item/757c4350688a86a3adc857ed 1 #include 2 阅读全文
posted @ 2013-08-21 17:14 ~~碾压机 阅读(230) 评论(0) 推荐(0) 编辑