随笔分类 -  二分三分查找

The Moving Points
摘要:Problem DescriptionThere are N points in total. Every point moves in certain direction and certain speed. We want to know at what time that the largest distance between any two points would be minimum. And also, we require you to calculate that minimum distance. We guarantee that no two points will 阅读全文

posted @ 2013-09-13 13:25 forevermemory 阅读(310) 评论(0) 推荐(0)

湘潭邀请赛Hurry Up
摘要:Problem DescriptionGG is some what afraid of his MM. Once his MM asks, he will always try his best to rush to their home. Obvious, he can run home in straight line directly. Alternatively, he can run to the main road and call the taxi. You can assume there is only one main road on the x-axis, with u 阅读全文

posted @ 2013-06-26 16:40 forevermemory 阅读(288) 评论(0) 推荐(0)

Texas Trip
摘要:DescriptionAfter a day trip with his friend Dick, Harry noticed a strange pattern of tiny holes in the door of his SUV. The local American Tire store sells fiberglass patching material only in square sheets. What is the smallest patch that Harry needs to fix his door?Assume that the holes are points 阅读全文

posted @ 2013-05-20 20:07 forevermemory 阅读(383) 评论(0) 推荐(0)

考研路茫茫——早起看书
摘要:Problem Description考研并不是说说就可以了,要付诸于行动。对于Lele来说,最痛苦的事莫过于早起看书了,不过为了考研,也就豁出去了。由于早起看书会对看书效率产生影响,所以对于要什么时候起床看书,还是有必要考虑的。经过周密的调查,Lele发现早起的时间会对上午和下午的看书效率都产生影响,具体如下:他把早起的程度标记为一个非负有理数X,X数值越大,表示越早起。1.对上午的影响F:符合 F = N / (X^2) 。其中N是一个参数。即越早起床,对上午的效率影响越少。2.对下午的影响Y:一般越早起,对下午的效率影响越大。不过Y和X的关系比较复杂,并且在不同时候关系也是不同的,于是L 阅读全文

posted @ 2013-05-20 11:00 forevermemory 阅读(291) 评论(0) 推荐(0)

Trouble
摘要:Problem DescriptionHassan is in trouble. His mathematics teacher has given him a very difficult problem called 5-sum. Please help him. The 5-sum problem is defined as follows: Given 5 sets S_1,...,S_5 of n integer numbers each, is there a_1 in S_1,...,a_5 in S_5 such that a_1+...+a_5=0?InputFirst li 阅读全文

posted @ 2013-05-19 11:14 forevermemory 阅读(226) 评论(0) 推荐(0)

A very hard mathematic problem
摘要:Problem Description Haoren is very good at solving mathematic problems. Today he is working a problem like this: Find three positive integers X, Y and Z (X < Y, Z > 1) that holds X^Z + Y^Z + XYZ = K where K is another given integer. Here the operator “^” means power, e.g., 2^3 = 2 * 2 * 2.... 阅读全文

posted @ 2013-05-19 01:41 forevermemory 阅读(217) 评论(0) 推荐(0)

Turn the corner
摘要:Problem Description Mr. West bought a new car! So he is travelling around the city.One day he comes to a vertical corner. The street he is currently in has a width x, the street he wants to turn to has a width y. The car has a length l and a width d.Can Mr. West go across the corner? Input Every l.. 阅读全文

posted @ 2013-05-16 19:31 forevermemory 阅读(179) 评论(0) 推荐(0)

The Frog's Games
摘要:Problem DescriptionThe annual Games in frogs' kingdom started again. The most famous game is the Ironfrog Triathlon. One test in the Ironfrog Triathlon is jumping. This project requires the frog athletes to jump over the river. The width of the river is L (1<= L <= 1000000000). There are n 阅读全文

posted @ 2013-05-16 16:23 forevermemory 阅读(167) 评论(0) 推荐(0)

内部收益率
摘要:Problem Description在金融中,我们有时会用内部收益率IRR来评价项目的投资财务效益,它等于使得投资净现值NPV等于0的贴现率。换句话说,给定项目的期数T、初始现金流CF0和项目各期的现金流CF1, CF2, ...,CFT,IRR是下面方程的解:NPV=CF0+CF1/(1+IRR)+CF2/(1+IRR)^2+...+CFT/(1+IRR)^T=0为了简单起见,本题假定:除了项目启动时有一笔投入(即初始现金流CF0 < 0)之外,其余各期均能赚钱(即对于所有i=1,2,...,T,CFi > 0)。根据定义,IRR可以是负数,但不能大于-1。Input输入文件最 阅读全文

posted @ 2012-12-05 20:26 forevermemory 阅读(575) 评论(0) 推荐(0)

Pie
摘要:Problem DescriptionMy birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each of them gets a piece of pie. This should be one piece of one pie, not several sm 阅读全文

posted @ 2012-12-05 17:42 forevermemory 阅读(178) 评论(0) 推荐(0)

Strange fuction
摘要:Problem DescriptionNow, here is a fuction:F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 <= x <=100)Can you find the minimum value when x is between 0 and 100. InputThe first line of the input contains an integer T(1<=T<=100) which means the number of test cases. Then T lines follow, each line 阅读全文

posted @ 2012-12-02 22:32 forevermemory 阅读(118) 评论(0) 推荐(0)

Can you solve this equation
摘要:Problem DescriptionNow,given the equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y,can you find its solution between 0 and 100;Now please try your lucky. InputThe first line of the input contains an integer T(1<=T<=100) which means the number of test cases. Then T lines follow, each line has a rea 阅读全文

posted @ 2012-12-02 00:36 forevermemory 阅读(130) 评论(0) 推荐(0)

查找元素
摘要:Problem Description在给出的数列中(数列中没有重复元素),判断某个元素存在与否。 Input输入的第1行为示例个数T,对于每个示例第1行为n(n<1000000),表示输入数列中元素的个数,下面1行为n个元素,第3行为查询元素的个数m(m<15000),下面m行为每个需要查询的元素。 Output输出每个需要查询元素的查询结果,如果查找到输出"Yes",否则输出"No"。 Sample Input151 4 5 2 3237Sample OutputYesNo#include<iostream>#include& 阅读全文

posted @ 2012-12-01 23:57 forevermemory 阅读(146) 评论(0) 推荐(0)