07 2013 档案
母函数的一些问题: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 ~~碾压机 阅读(183) 评论(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 ~~碾压机 阅读(160) 评论(0) 推荐(0) 编辑
第二次组队赛之: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 ~~碾压机 阅读(126) 评论(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 ~~碾压机 阅读(1031) 评论(0) 推荐(0) 编辑
图论基础之并查集的简单看法: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 ~~碾压机 阅读(170) 评论(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 ~~碾压机 阅读(196) 评论(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 ~~碾压机 阅读(179) 评论(0) 推荐(0) 编辑
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 ~~碾压机 阅读(407) 评论(0) 推荐(0) 编辑
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 ~~碾压机 阅读(198) 评论(0) 推荐(0) 编辑
25号搜索的一些例子,。。Oil Deposits&&Red and Black&&Knight Moves&&Catch That Cow&&Tempter of the Bone
摘要:Oil Depositshttp://poj.org/problem?id=1562一个简单又基础的搜索题目: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 char a[105][105]; 7 int s=0,i,j,x,y;“有多个函数,应把变量定义在外面”深搜 8 void dfs(int i,int j) 9 {10 if(ix||jy||a[i][j]!='@')11 return ;//直接跳出来.12 ... 阅读全文
posted @ 2013-07-25 23:27 ~~碾压机 阅读(255) 评论(1) 推荐(0) 编辑
第一次超水(我错了,有难度的)的组队赛!!!The Coco-Cola Store &&Multiple of 17&& Box Game
摘要:The Coco-Cola StoreOnce upon a time, there is a special coco-cola store. If you return three empty bottles to the shop, you'll get a full bottle of coco-cola to drink. If you have n empty bottles right in your hand, how many full bottles of coco-cola can you drink?InputThere will be at most 10 t 阅读全文
posted @ 2013-07-25 22:14 ~~碾压机 阅读(318) 评论(0) 推荐(0) 编辑
博弈 7月24号:HDU 2176(Nim博弈)
摘要:HDU 2176(Nim博弈)Problem Descriptionm堆石子,两人轮流取.只能在1堆中取.取完者胜.先取者负输出No.先取者胜输出Yes,然后输出怎样取子.例如5堆 5,7,8,9,10先取者胜,先取者第1次取时可以从有8个的那一堆取走7个剩下1个,也可以从有9个的中那一堆取走9个剩下0个,也可以从有10个的中那一堆取走7个剩下3个.Input输入有多组.每组第1行是m,m 2 using namespace std; 3 4 const int N = 200002; 5 6 int n, a[N]; 7 8 void So... 阅读全文
posted @ 2013-07-24 23:43 ~~碾压机 阅读(236) 评论(0) 推荐(0) 编辑
2013年7月23号:大数的加与乘I-number&&Power of Cryptography
摘要:这个问题需要对字符与整数的来回转变要非常熟悉,不然一下转不过弯来!!!当看到题目给的值的取值范围很大时,一般想到大数的加减乘除: I-numberhttp://acm.hdu.edu.cn/showproblem.php?pid=4608不解释,只要看到这个The length of x will not exceed 105.就知道了 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int main() 7 { 8 char a[200005]... 阅读全文
posted @ 2013-07-24 14:54 ~~碾压机 阅读(177) 评论(0) 推荐(0) 编辑
2013年7月20号: Flip Game&&The Pilots Brothers' refrigerator&&Coin Change&&Discrete Function&&Football Gambling II
摘要:Flip Gamehttp://acm.tzc.edu.cn/acmhome/problemdetail.do?method=showdetail&id=3248实实在在的深搜问题,注意几点:关于这类问题,最好变成0和1来回的切换(简洁,清晰)思路的话,因为深搜这是第一题,也是最难懂的,所以多看看,多想想。 1 #include 2 #include 3 #include 4 using namespace std; 5 int a[4][4]; 6 int flag=0,step; 7 int range(... 阅读全文
posted @ 2013-07-23 17:09 ~~碾压机 阅读(134) 评论(0) 推荐(0) 编辑
贪心算法小结。今年暑假不AC&&Radar Installation&&Y2K Accounting Bug&&Minimal Coverage
摘要:今年暑假不AC:http://acm.hdu.edu.cn/showproblem.php?pid=2037一个简单的贪心例题:思路:就是自己看: 1 #include 2 3 using namespace std; 4 5 int main() 6 7 { 8 9 int a[100],b[100]; 10 11 int n; 12 13 int e=0; 14 15 int cont=0; 16 17 ... 阅读全文
posted @ 2013-07-23 14:26 ~~碾压机 阅读(206) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示