上一页 1 ··· 3 4 5 6 7 8 下一页
2013年8月3日

第三次组队赛(bfs&&dfs)

摘要: A Knight's JourneyPOJ 2488用DFS来做:发现最难的是找到用什么来表示回溯!(step的加与减,格子的变与不变。。。) 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int c[30],d[35],n,m,flag,a[30][30]; 7 int b[8][2]={{-1,-2},{1,-2},{-2,-1},{2,-1},{-2,1},{2,1},{-1,2},{1,2}};//字典序(右边从小到大,左边再从小到大) 8 void dfs(int x,int y,in 阅读全文
posted @ 2013-08-03 10:32 ~~碾压机 阅读(206) 评论(0) 推荐(0) 编辑
2013年7月31日

母函数的一些问题:Ignatius and the Princess III&&Square Coins&&选课时间(题目已修改,注意读题)&&Holding Bin-Laden Captive!

摘要: 首先给出基本的模板:也就是以前所说的公式(不是什么很难的东西)#include using namespace std;const int lmax=10000; int c1[lmax+1],c2[lmax+1];int main(){ int n,i,j,k; while (cin>>n) {for (i=0;i 2 using namespace std; 3 int s(int a,int b) 4 { 5 if(a==1||b==1) return 1; 6 if(ab) return (s(a,b-1)+s(a-b,b)); 9 }10 int main()11 {.. 阅读全文
posted @ 2013-07-31 22:18 ~~碾压机 阅读(182) 评论(0) 推荐(0) 编辑

第二次组队赛之:Can you find it?&&Toxophily&& Party All the Time&& Squares

摘要: Can you find it?HDU2141题目好理解:在输入的三行数据中(必须每行取一个数)相加与输入的值比较。如果用暴力肯定会超时的:那么把俩行合并,再二分。。。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int ab[501*501]; 7 int dis(int h,int q)//二分查找 8 { 9 int left,right,mid;10 left=0;11 right=h-1;12 while(leftq)18 right=... 阅读全文
posted @ 2013-07-31 16:20 ~~碾压机 阅读(159) 评论(0) 推荐(0) 编辑
2013年7月30日

第二次组队赛之:Expanding Rods&&Aggressive cows&&Can you solve this equation?&&Strange fuction

摘要: Expanding Rodshttp://poj.org/problem?id=1905思路;先是一定要想到数学模型!!!从题目类型就是用二分法的:(以前应该做过的)就是一段圆的弧长注意是对半径进行二分!!(弧长公式:半径乘对应的角度)(一定要找到进行二分的对象) 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 double l; 7 double f(double a) 8 { 9 return 2*asin(l/(a*2))*a;//反三角s... 阅读全文
posted @ 2013-07-30 21:55 ~~碾压机 阅读(125) 评论(0) 推荐(0) 编辑

图论基础之Floyd(弗洛伊德算法&&Spfa算法&&邻接表):畅通工程续 HDU1874&&最短路 HDU2544

摘要: 畅通工程续HDU1874因为数据给的较小,可以用Floyd算法。 1 #include 2 #include 3 #include 4 using namespace std; 5 int main() 6 { 7 int MAX=10000; 8 int a[200][200]; 9 int n,m,i,j,k,x,y,z,s,t;10 while(scanf("%d %d",&n,&m)!=EOF)11 {12 for(i=0;iz)21 {22 a[x][y]=z;a[y][x... 阅读全文
posted @ 2013-07-30 10:21 ~~碾压机 阅读(1019) 评论(0) 推荐(0) 编辑
2013年7月29日

图论基础之并查集的简单看法:HDU 1232 畅通工程&&More is better

摘要: HDU 1232 畅通工程http://acm.hdu.edu.cn/showproblem.php?pid=1232第一个并查集的题目: 1 #include 2 #include 3 #include 4 using namespace std; 5 int father[1000]; 6 int Find(int a) 7 { 8 if(a!=father[a]) 9 return Find(father[a]);10 return father[a];11 }12 void Union(int a,int... 阅读全文
posted @ 2013-07-29 23:40 ~~碾压机 阅读(169) 评论(0) 推荐(0) 编辑

7月28号的题目:Printer Queue&&Parencodings&&Grandpa is Famous&&Emag eht htiw Em Pleh&&An Old Stone Game

摘要: Printer Queuehttp://acm.tzc.edu.cn/acmhome/problemdetail.do?method=showdetail&id=1044这个题目我想我是我做过的题目中思路最清晰的,代码最简洁的吧。(题目较简单) 1 #include 2 #include 3 #include 4 #include//主要考察队列的应用 5 using namespace std; 6 bool comp1(int x,int y) 7 { 8 return x>y; 9 }10 int main()11 {12 ... 阅读全文
posted @ 2013-07-29 11:30 ~~碾压机 阅读(194) 评论(0) 推荐(0) 编辑

7月23号的题目:Cutting a Painted Polygon&&Function Run Fun&&Sumdiv&&Raid&&A simple stone game

摘要: Cutting a Painted PolygonCutting a Painted PolygonTime Limit:1000MSMemory Limit:65536KB64bit IO Format:%I64d & %I64uDescriptionThere is a convex polygon with vertices painted in three colors: Red (R), Green (G) and Blue (B). It is known that all the colors are present... 阅读全文
posted @ 2013-07-29 10:39 ~~碾压机 阅读(178) 评论(0) 推荐(0) 编辑
2013年7月27日

Biggest Number&&ZOJ 3710 Friends&&Break Standard Weight

摘要: Biggest NumberYou have a maze with obstacles and non-zero digits in it:You can start from any square, walk in the maze, and finally stop at some square. Each step, you may only walk into one of thefour neighbouring squares (up, down, left, right)and you cannot walk into obstacles or walk into a squa 阅读全文
posted @ 2013-07-27 20:54 ~~碾压机 阅读(406) 评论(0) 推荐(0) 编辑
2013年7月26日

2013年7月21号的题目: New Year Bonus Grant&&Sarov zones

摘要: New Year Bonus Granthttp://acm.sgu.ru/problem.php?contest=0&problem=195最近发现题目都看不懂了,忧伤的一代(可能英语没学好,有道翻译的太次了)。貌似是个树的模型。题意:•Mocrosoft software这个公司有N个员工。除了老板(BillHates)以外,其他每个人都有一个自己的上司。现在过年了,老板打算给员工们发奖金。为了让支出最少,现在有三个规则:·Eachprogrammer may either assign a grant to one of his subordin... 阅读全文
posted @ 2013-07-26 22:17 ~~碾压机 阅读(193) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 下一页