EricYang

Tech Spot of Eric

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2011年4月26日

摘要: 食物链Time Limit:1000MSMemory Limit:10000KTotal Submissions:22186Accepted:6379Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。有人用两种说法对这N个动物所构成的食物链关系进行描述:第一种说法是"1 X Y",表示X和Y是同类。第二种说法是"2 X Y",表示X吃Y。此人对N个动物,用上述两种说法,一句接一句地说出K句话,这K 阅读全文
posted @ 2011-04-26 18:40 Eric-Yang 阅读(556) 评论(0) 推荐(0) 编辑

摘要: 一般要做到50行以内的程序不用调试、100行以内的二分钟内调试成功.ACM主要是考算法的,主要时间是花在思考算法上,不是花在写程序与debug上。下面给个计划你练练:第一阶段:练经典常用算法,下面的每个算法给我打上十到二十遍,同时自己精简代码,因为太常用,所以要练到写时不用想,10-15分钟内打完,甚至关掉显示器都可以把程序打出来。1.最短路(Floyd、Dijstra,BellmanFord)2.最小生成树(先写个prim,kruscal要用并查集,不好写)3.大数(高精度)加减乘除4.二分查找. (代码可在五行以内)5.叉乘、判线段相交、然后写个凸包.6.BFS、DFS,同时熟练hash表 阅读全文
posted @ 2011-04-26 17:13 Eric-Yang 阅读(276) 评论(0) 推荐(0) 编辑

2011年4月25日

摘要: 先说一下我的机器,操作系统是fedora14,目标是在本地架设用wordpress,只是实验用。1. 安装web/databases服务器,就是安装所谓LAMP的过程了。i. 你在安装Fedora系统的时候,你可以选择web server. 选择这个选项的时候Apache、PHP、MySQL就自动安装好了。ii. 或者你通过软件包管理来安装(System->Adminstration->Add/Remove Software)。安装httpd,PHP和MySQL包就行了。iii. 通过yum包管理器来安装(1). Apache(i). 首先检查系统是否已经安装过httpd$ rpm 阅读全文
posted @ 2011-04-25 21:23 Eric-Yang 阅读(505) 评论(0) 推荐(0) 编辑

2011年4月24日

摘要: Ubiquitous ReligionsTime Limit:5000MSMemory Limit:65536KTotal Submissions:13962Accepted:6676DescriptionThere are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out how many different religions students in your university b 阅读全文
posted @ 2011-04-24 17:01 Eric-Yang 阅读(548) 评论(0) 推荐(0) 编辑

2011年4月22日

摘要: POJ 并查集 题目汇总:http://hi.baidu.com/czyuan_acm/blog/item/531c07afdc7d6fc57cd92ab1.html继续数据结构的复习,本次的专题是:并查集。 并查集,顾名思义,干的就是“并”和“查”两件事。很多与集合相关的操作都可以用并查集高效的解决。 两个操作代码: int Find(int x) { if (tree[x].parent != x) { tree[x].parent = Find(tree[x].parent); } return tree[x].parent; } void Merge(int a, int b, int 阅读全文
posted @ 2011-04-22 21:01 Eric-Yang 阅读(177) 评论(0) 推荐(0) 编辑

摘要: Fence RepairTime Limit:2000MSMemory Limit:65536KTotal Submissions:10913Accepted:3459DescriptionFarmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needsN(1 ≤N≤ 20,000) planks of wood, each having some integer lengthLi(1 ≤Li≤ 50,000) uni 阅读全文
posted @ 2011-04-22 20:04 Eric-Yang 阅读(201) 评论(0) 推荐(0) 编辑

摘要: BabelfishTime Limit:3000MSMemory Limit:65536KTotal Submissions:18425Accepted:7950DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand them.InputInput consists of 阅读全文
posted @ 2011-04-22 18:01 Eric-Yang 阅读(194) 评论(0) 推荐(0) 编辑

2011年4月21日

摘要: SquaresTime Limit:3500MSMemory Limit:65536KTotal Submissions:9185Accepted:3224DescriptionA square is a 4-sided polygon whose sides have equal length and adjacent sides form 90-degree angles. It is also a polygon such that rotating about its centre by 90 degrees gives the same polygon. It is not the 阅读全文
posted @ 2011-04-21 18:52 Eric-Yang 阅读(202) 评论(0) 推荐(0) 编辑

2011年4月20日

摘要: EqsTime Limit:5000MSMemory Limit:65536KTotal Submissions:5966Accepted:2885DescriptionConsider equations having the following form:a1x13+ a2x23+ a3x33+ a4x43+ a5x53=0The coefficients are given integers from the interval [-50,50].It is consider a solution a system (x1, x2, x3, x4, x5) that verifies t 阅读全文
posted @ 2011-04-20 18:50 Eric-Yang 阅读(394) 评论(0) 推荐(0) 编辑

摘要: 数据结构:数据间关系 + 数据存储方式。常见的数据结构有链表,堆,栈,队列,表,树,图等。选择何种数据结构,取决于需要解决什么样的问题。哈希表(hash table),即散列表,是根据关键码值(Key value)而直接进行访问的数据结构。其核心思想是选择一个哈希函数或者随机函数,用一个和记录相关的值作为函数的参数,生成存放该记录的块地址。这个算法的优点是寻址的时间复杂度是o(1),缺点是数据以无序的方式存储。将数据存入哈希表时,利用哈希函数为该数据安排存储位置;查找指定值数据时,也按照哈希函数得到目标索引。实际操作起来时,由于数值域和索引域大小不同,所以不能简单地线性映射,而是需要建立较复杂 阅读全文
posted @ 2011-04-20 17:13 Eric-Yang 阅读(415) 评论(0) 推荐(0) 编辑