08 2013 档案

摘要:DescriptionA well known algorithm called heapsort is a deterministic sorting algorithm taking O(n log n) time and O(1) additional memory. Let us describe ascending sorting of an array of different integer numbers. The algorithm consists of two phases. In the first phase, called heapification, the ar 阅读全文
posted @ 2013-08-31 21:02 Oyking 阅读(408) 评论(0) 推荐(0)
摘要:DescriptionAndy is fond of old computers. He loves everything about them and he uses emulators of old operating systems on his modern computer. Andy also likes writing programs for them. Recently he has decided to write a text editor for his favorite text-mode operating system. The most difficult ta 阅读全文
posted @ 2013-08-31 19:02 Oyking 阅读(233) 评论(0) 推荐(0)
摘要:DescriptionKolya has returned from a summer camp and now he's a realcommunication fiend. He spends all his free time on the Web chatting with his friends via ICQ. However, lately the protocol of this service was changed once again, and Kolya's client stopped working. Now, in order to communi 阅读全文
posted @ 2013-08-29 21:37 Oyking 阅读(262) 评论(0) 推荐(0)
摘要:DescriptionIn whiteblack on blackwhite is written the utterance that has been censored by the Ministry of Truth. Its author has already disappeared along with his whole history, and now, while Big Brother is watching somebody else, you, as an ordinary official of the Minitrue, have to delete some le 阅读全文
posted @ 2013-08-29 19:55 Oyking 阅读(407) 评论(0) 推荐(0)
摘要:DescriptionSergey and Denis closely followed the Chinese Football Championship, which has just come to an end. They supported theKatrapsandKomolotivteams, but, unfortunately, these teams tied for last place in the championship. Sergey was so disappointed that he suggested Denis that they change to h 阅读全文
posted @ 2013-08-29 19:49 Oyking 阅读(552) 评论(0) 推荐(0)
摘要:DescriptionYou have just run out of disk space and decided to delete some of your directories. Rationally, you will first have an exploration of what you have in your file system. And more rationally, you will do this exploration through a command line interface. The interface used in this problem i 阅读全文
posted @ 2013-08-29 00:02 Oyking 阅读(263) 评论(0) 推荐(0)
摘要:DescriptionA plotter is a vector graphics printing device that connects to a computer to print graphical plots. There are two types of plotters: pen p... 阅读全文
posted @ 2013-08-28 12:23 Oyking 阅读(289) 评论(0) 推荐(0)
摘要:DescriptionHave you ever thought about comparing the weight of fruits? That’s what you should do in this problem! Given a series of fruit weight comparisons, you should anticipate the result of another comparison. In this problem, all fruits of the same kind are identical and have the same weights. 阅读全文
posted @ 2013-08-28 12:14 Oyking 阅读(315) 评论(0) 推荐(0)
摘要:DescriptionDavy Jones: You've been captain of the Black Pearl for 13 years. That was our agreement. Jack: Technically I was only captain for two years, then I was mutinied upon. Davy Jones: Then you were a poor captain, but a captain nonetheless. Have you not introduced yourself as Captain Jack 阅读全文
posted @ 2013-08-26 12:26 Oyking 阅读(497) 评论(0) 推荐(0)
摘要:DescriptionBootstrap: Wondering how it's played? Will: It's a game of deception. But your bet includes all the dice, not just your own. What are they wagering? Bootstrap: Oh, the only thing we have. Years of service. Will: So any crew member can be challenged? Bootstrap: Aye. Anyone. Will: I 阅读全文
posted @ 2013-08-25 22:03 Oyking 阅读(435) 评论(2) 推荐(0)
摘要:DescriptionOne day, Implus gets interested in binary addition and binary carry. He will transfer all decimal digits to binary digits to make the addition. Not as clever as Gauss, to make the addition from a to b, he will add them one by one from a to b in order. For example, from 1 to 3 (decimal dig 阅读全文
posted @ 2013-08-24 18:01 Oyking 阅读(396) 评论(0) 推荐(0)
摘要:DescriptionSuppose that G is an undirected graph, and the value ofstabis defined as follows:Among the expression,G-i, -jis the remainder after removing node i, node j and all edges that are directly relevant to the previous two nodes.cntCompentis the number of connected components of X independently 阅读全文
posted @ 2013-08-24 16:59 Oyking 阅读(416) 评论(0) 推荐(0)
摘要:A and B are playing a shooting game on a battlefield consisting of square-shaped unit blocks. The blocks are occupying some consecutive columns, and the perimeter of the figure equals the perimeter of its minimal bounding box. The figure (a) below is a valid battlefield, but (b) and (c) are not, bec 阅读全文
posted @ 2013-08-23 23:06 Oyking 阅读(394) 评论(0) 推荐(0)
摘要:You live in a small town withRbidirectional roads connectingCcrossings and you want to go from crossing 1 to crossingCas soon as possible. You can visit other crossings before arriving at crossingC, but it's not mandatory.You have exactly one chance to ask your friend to repair exactly one exist 阅读全文
posted @ 2013-08-23 22:45 Oyking 阅读(738) 评论(0) 推荐(0)
摘要:You 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 square more than o 阅读全文
posted @ 2013-08-23 22:17 Oyking 阅读(1445) 评论(0) 推荐(0)
摘要:In finance, Internal Rate of Return (IRR) is the discount rate of an investment when NPV equals zero. Formally, givenT,CF0,CF1, ...,CFT, thenIRRis the solution to the following equation:NPV=CF0+++K+= 0Your task is to find all validIRRs. In this problem, the initial cash-flowCF0 0for alli= 1, 2,...). 阅读全文
posted @ 2013-08-23 22:15 Oyking 阅读(582) 评论(0) 推荐(0)
摘要:Input: Standard Input Output: Standard Output� There is a rectangle on the cartesian plane, with bottom-left corner at (0,0) and top-right corner at(L,W). There is a ball centered at(x,y), with radius=R, shown belowAt time 0, the ball starts to move along a ray with polar anglea(the angle from posit 阅读全文
posted @ 2013-08-23 21:19 Oyking 阅读(345) 评论(0) 推荐(0)
摘要:Problem DescriptionConsider a Depth-First-Search(DFS) spanning tree T of a undirected connected graph G, we define a T-Simple Circle as a path v1, v2, ..., vk(v1= vk) in G that contains at most one edge which not belongs to the DFS spanning tree T.Given a graph G, we process DFS on G starting from v 阅读全文
posted @ 2013-08-22 19:50 Oyking 阅读(684) 评论(0) 推荐(0)
摘要:Problem Description Let f(x) = anxn+...+ a1x +a0, in which ai(0 = 3, otherwise abs(ai) 2 #include 3 #include 4 #include 5 using namespace std; 6 typedef long long LL; 7 8 const int MAXN = 8; 9 10 int T, deg;11 LL phi;12 LL a[MAXN];13 14 LL f(LL x, LL m) {15 LL ret = 0, xx = 1;16 for(in... 阅读全文
posted @ 2013-08-22 14:25 Oyking 阅读(455) 评论(5) 推荐(0)
摘要:Problem Description Bob gets tired of playing games, leaves Alice, and travels to Changsha alone. Yuelu Mountain, Orange Island, Window of the World, the Provincial Museum etc...are scenic spots Bob wants to visit. However, his time is very limited, he can’t visit them all. Assuming that there are.. 阅读全文
posted @ 2013-08-22 12:25 Oyking 阅读(387) 评论(0) 推荐(0)
摘要:Problem Description A sequence Snis defined as:Where a, b, n, m are positive integers.┌x┐is the ceil of x. For example, ┌3.14┐=4. You are to calculate Sn. You, a top coder, say: So easy!Input There are several test cases, each test case in one line contains four positive integers: a, b, n, m. Whe... 阅读全文
posted @ 2013-08-22 00:05 Oyking 阅读(428) 评论(0) 推荐(1)
摘要:Problem Description One day, a hunter named James went to a mysterious area to find the treasures. James wanted to research the area and brought all treasures that he could. The area can be represented as a N*M rectangle. Any points of the rectangle is a number means the cost of research it,-1 mea.. 阅读全文
posted @ 2013-08-21 22:48 Oyking 阅读(460) 评论(0) 推荐(0)
摘要:DescriptionAn oligarch Vovan, as many other oligarchs, transports oil from West Cuckooland to East Cuckooland. He owns a huge oil-producing station in West Cuckooland, an equally huge oil-refining station in East Cuckooland and a system of oil pipelines to move oil from one country to another. Vovan 阅读全文
posted @ 2013-08-20 16:25 Oyking 阅读(395) 评论(0) 推荐(0)
摘要:Problem DescriptionA Fibonacci sequence is calculated by adding the previous two members the sequence, with the first two members being both 1. F(1) = 1, F(2) = 1, F(3) = 1,F(4) = 1, F(n>4) = F(n - 1) + F(n-2) + F(n-3) + F(n-4) Your task is to take a number as input, and print that Fibonacci numb 阅读全文
posted @ 2013-08-20 15:14 Oyking 阅读(196) 评论(0) 推荐(0)
摘要:Problem DescriptionGiven an integer N(0 ≤ N ≤ 10000), your task is to calculate N!InputOne N in one line, process to the end of file.OutputFor each N, output N! in one line.题目大意:求N的阶乘。思路:用高精度,内存存不下这么多只能每次都重新算了……代码(3093MS): 1 //模板测试 2 #include 3 #include 4 #include 5 #include 6 #include 7... 阅读全文
posted @ 2013-08-20 15:11 Oyking 阅读(233) 评论(0) 推荐(0)
摘要:1、凸包 1 inline bool cmp(const POINT &a, const POINT &b) { 2 if(a.y == b.y) return a.x = 0; 8 } 9 10 inline double dist(POINT &a, POINT &b) {11 return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));12 }13 14 void Graham_scan() {15 std::sort(p, p + n, cmp);16 top = 1;17... 阅读全文
posted @ 2013-08-19 23:32 Oyking 阅读(388) 评论(0) 推荐(0)
摘要:一、平衡树1、treap树 1 int key[MAXN], weight[MAXN], child[MAXN][2], size[MAXN]; 2 int stk[MAXN], top, poi_cnt;//not use point 3 4 inline int newNode(int k) ... 阅读全文
posted @ 2013-08-19 23:27 Oyking 阅读(477) 评论(0) 推荐(0)
摘要:1、求逆元1 int inv(int a) {2 if(a == 1) return 1;3 return (MOD - MOD / a) * inv(MOD % a);4 }View Code 2、线性筛法 1 bool isPrime[MAXN]; 2 int label[MAX... 阅读全文
posted @ 2013-08-19 23:14 Oyking 阅读(262) 评论(0) 推荐(0)
摘要:一、二分图1、最大匹配数=最大流=最小割=最小点集覆盖=总点数-最大独立集2、KM算法(最佳完美匹配) 1 int mat[MAXN][MAXN], slack[MAXN], Lx[MAXN], Ly[MAXN], left[MAXN]; 2 bool S[MAXN], T[MAXN]; ... 阅读全文
posted @ 2013-08-19 23:11 Oyking 阅读(380) 评论(0) 推荐(0)
摘要:DescriptionFacer is addicted to a game called "Tidy is learning to swim". But he finds it too easy. So he develops a new game called "Facer is learning to swim" which is more difficult and more interesting.In the new game, a robot named "Facer" is swimming in a pool. Th 阅读全文
posted @ 2013-08-19 20:09 Oyking 阅读(531) 评论(0) 推荐(0)
摘要:DescriptionTed has a new house with a huge window. In this big summer, Ted decides to decorate the window with some posters to prevent the glare outside. All things that Ted can find are rectangle posters.However, Ted is such a picky guy that in every poster he finds something ugly. So before he pas 阅读全文
posted @ 2013-08-17 16:51 Oyking 阅读(398) 评论(0) 推荐(0)
摘要:DescriptionThe city of M is a famous shopping city and its open-air shopping malls are extremely attractive. During the tourist seasons, thousands of people crowded into these shopping malls and enjoy the vary-different shopping.Unfortunately, the climate has changed little by little and now rainy d 阅读全文
posted @ 2013-08-16 22:52 Oyking 阅读(283) 评论(0) 推荐(0)
摘要:DescriptionStudents often have problems taking up seats. When two students want the same seat, a quarrel will probably begin.It will have very bad effect when such subjects occur on the BBS. So, we urgently need a seat-taking-up rule. After several days of argument, the rule finally comes out: As sh 阅读全文
posted @ 2013-08-16 17:14 Oyking 阅读(339) 评论(0) 推荐(0)
摘要:DescriptionOn the evening of 3 August 1492, Christopher Columbus departed from Palos de la Frontera with a few ships, starting a serious of voyages of... 阅读全文
posted @ 2013-08-16 16:18 Oyking 阅读(421) 评论(0) 推荐(0)
摘要:DescriptionToo worrying about the house price bubble, poor Mike sold his house and rent an apartment in a 50-floor building several months ago. This building has only one elevator because it is a so called “rotten tail building”. There are always a lot of people crowding at the gate of the elevator 阅读全文
posted @ 2013-08-16 14:56 Oyking 阅读(396) 评论(0) 推荐(0)
摘要:DescriptionPanagola, The Lord of city F likes to parade very much. He always inspects his city in his car and enjoys the welcome of his citizens. City... 阅读全文
posted @ 2013-08-15 16:48 Oyking 阅读(277) 评论(0) 推荐(0)
摘要:一、代码: 1、求逆元(原理貌似就是拓展欧几里得,要求MOD是素数): 2、底层优化(正确性未验证): 3、扩栈,这玩意儿在OJ上用能防爆? 4、神速读入fread 二、神牛blog matrix67 ZKW watashi 三、专题 动态规划系列: 数位dp模板 字符串系列: 【专辑】AC自动机 阅读全文
posted @ 2013-08-14 23:48 Oyking 阅读(1291) 评论(0) 推荐(0)
摘要:DescriptionN(3 2 #include 3 #include 4 #include 5 using namespace std; 6 typedef long long LL; 7 8 const int MAXN = 20010; 9 10 struct Node {11 int val, id;12 bool operator 0) {29 ret += tree[k];30 k -= lowbit(k);31 }32 return ret;33 }34 35 inline void modify(int... 阅读全文
posted @ 2013-08-14 23:22 Oyking 阅读(320) 评论(0) 推荐(0)
摘要:DescriptionJohn is the only priest in his town. October 26th is the John's busiest day in a year because there is an old legend in the town that the couple who get married on that day will be forever blessed by the God of Love. This year N couples plan to get married on the blessed day. The i-th 阅读全文
posted @ 2013-08-14 22:09 Oyking 阅读(360) 评论(0) 推荐(0)
摘要:DescriptionFor a tree, which nodes and edges are all weighted, the ratio of it is calculated according to the following equation.Given a complete grap... 阅读全文
posted @ 2013-08-14 20:33 Oyking 阅读(347) 评论(0) 推荐(0)
摘要:DescriptionSheryl works for a software company in the country of Brada. Her job is to develop a Windows operating system. People in Brada are incredibly conservative. They even never use graphical monitors! So Sheryl’s operating system has to run in text mode and windows in that system are formed by 阅读全文
posted @ 2013-08-14 18:41 Oyking 阅读(1213) 评论(0) 推荐(0)
摘要:There arenpsychos standing in a line. Each psycho is assigned a unique integer from1ton. At each step every psycho who has an id greater than the psycho to his right (if exists) kills his right neighbor in the line. Note that a psycho might kill and get killed at the same step.You're given the i 阅读全文
posted @ 2013-08-14 15:48 Oyking 阅读(877) 评论(0) 推荐(0)
摘要:Yaroslav has an arrayp = p1, p2, ..., pn(1 ≤ pi ≤ n), consisting ofndistinct integers. Also, he hasmqueries:Query numberiis represented as a pair of integersli,ri(1 ≤ li ≤ ri ≤ n).The answer to the queryli, riis the number of pairs of integersq,w(li ≤ q, w ≤ ri)such thatpqis the divisor ofpw.Help Ya 阅读全文
posted @ 2013-08-14 12:26 Oyking 阅读(917) 评论(0) 推荐(1)
摘要:DescriptionKitty is a little cat. She is crazy about a game recently.There arenscenes in the game(mark from 1 ton). Each scene has a numberpi. Kitty's score will become least_common_multiple(x,pi) when Kitty enter theithscene.xis the score that Kitty had previous. Notice that Kitty will become m 阅读全文
posted @ 2013-08-13 17:43 Oyking 阅读(274) 评论(0) 推荐(0)
摘要:DescriptionThis summer's heat wave and drought unleashed devastating wildfires all across the Earth. Of course, a tiny country on the island "Yars and... 阅读全文
posted @ 2013-08-12 23:21 Oyking 阅读(381) 评论(0) 推荐(0)
摘要:Description176. Flow constructiontime limit per test: 1 sec.memory limit per test: 4096 KBinput: standardoutput: standardYou have given the net consisting of nodes and pipes; pipes connect the nodes. Some substance can flow by pipes, and flow speed in any pipe doesn't exceed capacity of this pip 阅读全文
posted @ 2013-08-12 17:30 Oyking 阅读(434) 评论(0) 推荐(0)
摘要:DescriptionGensokyois a world which exists quietly beside ours, separated by a mystical border. It is a utopia where humans and other beings such as fairies,youkai(phantoms), and gods live peacefully together. Shameimaru Aya is a crow tengu with the ability to manipulate wind who has been inGensokyo 阅读全文
posted @ 2013-08-12 13:54 Oyking 阅读(846) 评论(0) 推荐(0)
摘要:DescriptionThe terrorist group leaded by a well known international terrorist Ben Bladen is buliding a nuclear reactor to produce plutonium for the nuclear bomb they are planning to create. Being the wicked computer genius of this group, you are responsible for developing the cooling system for the 阅读全文
posted @ 2013-08-11 23:40 Oyking 阅读(465) 评论(0) 推荐(1)
摘要:Description给你一个m*n的格子的棋盘,每个格子里面有一个非负数。 从中取出若干个数,使得任意的两个数所在的格子没有公共边,就是说所取数所在的2个格子不能相邻,并且取出的数的和最大。Input包括多个测试实例,每个测试实例包括2整数m,n和m*n个非负数(m 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int MAXN = 3000; 8 const int MAXE = 30010; 9 const int INF = 0x3fff3fff; 10 11 struct ... 阅读全文
posted @ 2013-08-10 18:07 Oyking 阅读(329) 评论(0) 推荐(0)
摘要:DescriptionIt is year 2500 A.D. and there is a terrible war between the forces of the Earth and the Mars. Recently, the commanders of the Earth are informed by their spies that the invaders of Mars want to land some paratroopers in them×ngrid yard of one their main weapon factories in order to 阅读全文
posted @ 2013-08-10 16:40 Oyking 阅读(421) 评论(0) 推荐(0)
摘要:DescriptionYou’ve finally got mad at “the world’s most stupid” employees of yours and decided to do some firings. You’re now simply too mad to give response to questions like “Don’t you think it is an even more stupid decision to have signed them?”, yet calm enough to consider the potential profit a 阅读全文
posted @ 2013-08-09 23:00 Oyking 阅读(509) 评论(0) 推荐(0)
摘要:DescriptionIn modern society, each person has his own friends. Since all the people are very busy, they communicate with each other only by phone. You can assume that people A can keep in touch with people B, only if 1. A knows B's phone number, or 2. A knows people C's phone number and C ca 阅读全文
posted @ 2013-08-09 16:59 Oyking 阅读(365) 评论(0) 推荐(0)
摘要:DescriptionYou are the lead programmer for the Securitron 9042, the latest and greatest in home security software from Jellern Inc. (Motto: We secure your stuff so YOU can't even get to it). The software is designed to "secure" a room; it does this by determining the minimum number of 阅读全文
posted @ 2013-08-08 23:43 Oyking 阅读(289) 评论(0) 推荐(0)
摘要:DescriptionCIA headquarter collects data from across the country through its classified network. They have been using optical fibres long before it's been deployed on any civilian projects. However they are still under a lot pressure recently because the data are growing rapidly. As a result the 阅读全文
posted @ 2013-08-08 22:35 Oyking 阅读(473) 评论(0) 推荐(0)
摘要:DescriptionGabiluso is one of the greatest spies in his country. Now he’s trying to complete an “impossible” mission ----- to make it slow for the arm... 阅读全文
posted @ 2013-08-07 19:56 Oyking 阅读(419) 评论(0) 推荐(0)
摘要:DescriptionSomewhere near the south pole, a number of penguins are standing on a number of ice floes. Being social animals, the penguins would like to get together, all on the same floe. The penguins do not want to get wet, so they have use their limited jump distance to get together by jumping from 阅读全文
posted @ 2013-08-07 16:57 Oyking 阅读(418) 评论(0) 推荐(0)
摘要:DescriptionA group ofMtourists are walking along the Karlutka river. They want to cross the river, but they couldn't find a bridge. Fortunately, there are some piles of rubbish floating in the water, and thetourists have decided to try to cross the river by jumping from one pile to another.Atour 阅读全文
posted @ 2013-08-06 20:31 Oyking 阅读(458) 评论(0) 推荐(0)
摘要:DescriptionBreaking news! A Russian billionaire has bought a yet undisclosed NBA team. He's planning to invest huge effort and money into making that team the best. And in fact he's been very specific about the expected result: the first place.Being his advisor, you need to determine whether 阅读全文
posted @ 2013-08-04 23:32 Oyking 阅读(361) 评论(0) 推荐(0)
摘要:DescriptionGiven a weighted directed graph, we define the shortest path as the path who has the smallest length among all the path connecting the source vertex to the target vertex. And if two path is said to be non-overlapping, it means that the two path has no common edge. So, given a weighted dir 阅读全文
posted @ 2013-08-03 22:13 Oyking 阅读(396) 评论(0) 推荐(0)
摘要:DescriptionFarmer John is constructing a new milking machine and wishes to keep it secret as long as possible. He has hidden in it deep within his farm and needs to be able to get to the machine without being detected. He must make a total of T (1 #include #include using namespace std;const int MAXN 阅读全文
posted @ 2013-08-03 17:54 Oyking 阅读(423) 评论(0) 推荐(0)
摘要:DescriptionGiven two strings, you have to tell the length of the Longest Common Substring of them.For example:str1 = bananastr2 = cianaicSo the Longes... 阅读全文
posted @ 2013-08-02 16:08 Oyking 阅读(1656) 评论(0) 推荐(0)
摘要:DescriptionYou are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to... 阅读全文
posted @ 2013-08-01 16:12 Oyking 阅读(9730) 评论(0) 推荐(4)

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