04 2013 档案

摘要:转载自:点击打开链接//第一期计算几何题的特点与做题要领:1.大部分不会很难,少部分题目思路很巧妙2.做计算几何题目,模板很重要,模板必须高度可靠。3.要注意代码的组织,因为计算几何的题目很容易上两百行代码,里面大部分是模板。如果代码一片混乱,那么会严重影响做题正确率。4.注意精度控制。5.能用整数的地方尽量用整数,要想到扩大数据的方法(扩大一倍,或扩大sqrt2)。因为整数不用考虑浮点误差,而且运算比浮点快。一。点,线,面,形基本关系,点积叉积的理解POJ 2318 TOYS(推荐)http://acm.pku.edu.cn/JudgeOnline/problem?id=2318POJ 23 阅读全文
posted @ 2013-04-29 17:20 free斩 阅读(466) 评论(0) 推荐(0)
摘要:比赛时一直错贴的叶找的代码:#include #include #include using namespace std; #define MAXN 10000 const int mod[20]={1,1,2,6,4,2,2,4,2,8,4,4,8,4,6,8,8,6,8,2};//列出钱20个的阶层最后一位 int ld(char* buf) { int len = strlen(buf), a[MAXN], i, c, ret = 1; if(len==1) return mod[buf[0]-'0'];//如果是个位数直接输出 for(i=0;... 阅读全文
posted @ 2013-04-23 21:47 free斩 阅读(170) 评论(0) 推荐(0)
摘要:Wooden SticksProblem DescriptionThere is a pile of n wooden sticks. The length and weight of each stick are known in advance. The sticks are to be processed by a woodworking machine in one by one fashion. It needs some time, called setup time, for the machine to prepare processing a stick. The setup 阅读全文
posted @ 2013-04-20 20:19 free斩 阅读(193) 评论(0) 推荐(0)
摘要:Phone ListTime Limit:1000MSMemory Limit:65536KTotal Submissions:18122Accepted:5769DescriptionGiven a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let's say the phone catalogue listed these numbers:Emergency 911Alice 97 625 999Bob 91 1 阅读全文
posted @ 2013-04-18 19:39 free斩 阅读(236) 评论(0) 推荐(0)
摘要:RochambeauTime Limit:5000MSMemory Limit:65536KTotal Submissions:1603Accepted:556DescriptionNchildren are playing Rochambeau (scissors-rock-cloth) game with you. One of them is the judge. The rest children are divided into three groups (it is possible that some group is empty). You don’t know who is 阅读全文
posted @ 2013-04-14 16:08 free斩 阅读(222) 评论(0) 推荐(0)
摘要:Connections in Galaxy WarTime Limit:3 Seconds Memory Limit:32768 KBIn order to strengthen the defense ability, many stars in galaxy allied together and built many bidirectional tunnels to exchange messages. However, when the Galaxy War began, some tunnels were destroyed by the monsters from another 阅读全文
posted @ 2013-04-14 14:41 free斩 阅读(265) 评论(0) 推荐(1)
摘要:How Many Answers Are WrongTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1384Accepted Submission(s): 562Problem DescriptionTT and FF are ... friends. Uh... very very good friends -________-bFF is a bad boy, he is always wooing TT to play the follo 阅读全文
posted @ 2013-04-14 13:31 free斩 阅读(370) 评论(1) 推荐(0)
摘要:题意:给你 N 件不同的商品,每件商品最多可以买一次。 每件物品对应两个值 pi di pi 表示物品的价值,di 表示可以买的最迟时间(也就是第一天到第 di 天都可以买这件物品) 规定:每天最多可以买一件物品,问你可以得到的最大价值。算法:贪心 看了KB神的题解,他用的并查集,等下贴个代码。思路【贪心版本】:将物品按照价值从大到小排序 依次枚举每件物品 从可以买的最后一天枚举,看是否可以买 注意:标记天数。思路【KB的并查集版本】:将物品按照价值从大到小排序 处理的时候选择最后的一个不冲突点。 ... 阅读全文
posted @ 2013-04-14 12:41 free斩 阅读(274) 评论(0) 推荐(0)
摘要:A Bug's LifeTime Limit:10000MSMemory Limit:65536KTotal Submissions:23484Accepted:7639DescriptionBackgroundProfessor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different genders and that they only interact with bugs of the opposite gender 阅读全文
posted @ 2013-04-14 12:13 free斩 阅读(167) 评论(0) 推荐(0)
摘要:算法:并查集。题意:给你 N 个农场 给定 M 条关系 :x y len dir 表示农场 y 在农场 x 的 dir 方向的 len 米处 输入 Q 个问题:x y index 在知道从从第一条关系到第 index 条关系的情况下,判断农场 x 和农场 y 的相对关系。 如果能判断,则输出相对关系:水平距离差 + 垂直距离差 如果不能判断,则输出 -1.注意:每组测试数据中的每个问题中的 index 是按照从小到大的顺序给出的,所以使得问题简单化。思路:p[] 记录父亲节... 阅读全文
posted @ 2013-04-13 18:56 free斩 阅读(170) 评论(0) 推荐(0)
摘要:Wireless NetworkTime Limit:10000MSMemory Limit:65536KTotal Submissions:13361Accepted:5659DescriptionAn earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all computers in the n 阅读全文
posted @ 2013-04-13 13:07 free斩 阅读(226) 评论(0) 推荐(0)
摘要:Cube StackingTime Limit:2000MSMemory Limit:30000KTotal Submissions:15951Accepted:5448Case Time Limit:1000MSDescriptionFarmer John and Betsy are playing a game with N (1 const int maxn = 30000+10; int p[maxn]; int r[maxn]; //下面的个数 int sum[maxn]; //总个数 int find(int x) { if(x == p[x]) return x;... 阅读全文
posted @ 2013-04-13 11:47 free斩 阅读(239) 评论(0) 推荐(0)
摘要:FibonacciTime Limit:1000MSMemory Limit:65536KTotal Submissions:6881Accepted:4873DescriptionIn the Fibonacci integer sequence,F0= 0,F1= 1, andFn=Fn− 1+Fn− 2forn≥ 2. For example, the first ten terms of the Fibonacci sequence are:0, 1, 1, 2, 3, 5, 8, 13, 21, 34, …An alternative formula for the Fibonacc 阅读全文
posted @ 2013-04-09 21:14 free斩 阅读(218) 评论(0) 推荐(0)
摘要:转载来自:http://www.cnblogs.com/huangfeihome/archive/2012/09/07/2675123.html并查集。 首先,以为k个询问中的I是乱序的,直接被吓傻了,后来看讨论版才发现I是升序的…… 这道题让我对并查集有一个新的认识:根的代表性是非常强的!并查集里如果某个节点的改动会影响到整个并查集的所有节点,那么,在union_set的时候只需要改动根节点就可以了,当然,在find_set函数里要对所有节点进行更新(这相当于一种延时标记)。我们知道,find_set函数走了两条路,一条是前往根的路,一条是从跟返回的路,那么,如果发现根已经被改动,必须在.. 阅读全文
posted @ 2013-04-08 21:54 free斩 阅读(174) 评论(0) 推荐(0)
摘要:Find them, Catch themTime Limit:1000MSMemory Limit:10000KTotal Submissions:23915Accepted:7167DescriptionThe police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon and Gang Snake. However, the police first needs to identify whi 阅读全文
posted @ 2013-04-08 19:04 free斩 阅读(327) 评论(0) 推荐(0)
摘要:小希的迷宫Problem Description上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。小希现在把她的设计图给你,让你帮忙判断她的设计图是否符合她的设计思路。比如下面的例子,前两个是符合条件的,但是最后一个却有两种方法从5到达8。Input输入包含多组数据,每组数据是一个以0 0结 阅读全文
posted @ 2013-04-07 20:58 free斩 阅读(186) 评论(0) 推荐(0)
摘要:POJ 1308hdu 1325Is It A Tree?Time Limit:1000MSMemory Limit:10000KTotal Submissions:17384Accepted:5956DescriptionA tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following propert 阅读全文
posted @ 2013-04-07 20:05 free斩 阅读(231) 评论(0) 推荐(0)
摘要:食物链Time Limit:1000MSMemory Limit:10000KTotal Submissions:33805Accepted:9820Description动物王国中有三类动物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 @ 2013-04-07 14:18 free斩 阅读(206) 评论(0) 推荐(0)
摘要:Ubiquitous ReligionsTime Limit:5000MSMemory Limit:65536KTotal Submissions:19292Accepted:9472DescriptionThere 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 @ 2013-04-06 22:03 free斩 阅读(148) 评论(0) 推荐(0)
摘要:The SuspectsTime Limit:1000MSMemory Limit:20000KTotal Submissions:17149Accepted:8272DescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is to separa 阅读全文
posted @ 2013-04-06 21:49 free斩 阅读(170) 评论(0) 推荐(0)