POJ1064 Cable master

Description

Inhabitants of the Wonderland have decided to hold a regional programming contest. The Judging Committee has volunteered and has promised to organize the most honest contest ever. It was decided to connect computers for the contestants using a "star" topology - i.e. connect them all to a single central hub. To organize a truly honest contest, the Head of the Judging Committee has decreed to place all contestants evenly around the hub on an equal distance from it.

lower_bound()和upper_bound()的使用

函数 lower_bound()firstlast 中的前闭后开区间进行二分查找,返回不小于 val 的第一个元素位置,如果所有元素都小于 val,则返回 last 位置。

POJ3320 Jessica's Reading Problem

Description

Jessica's a very lovely girl wooed by lots of boys. Recently she has a problem. The final exam is coming, yet she has spent little time on it. If she wants to pass it, she has to master all ideas included in a very thick text book. The author of that text book, like other authors, is extremely fussy about the ideas, thus some ideas are covered more than once. Jessica think if she managed to read each idea at least once, she can pass the exam. She decides to read only one contiguous part of the book which contains all ideas covered by the entire book. And of course, the sub-book should be as thin as possible.

POJ3061 Subsequence

Description

A sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Write a program to find the minimal length of the subsequence of consecutive elements of the sequence, the sum of which is greater than or equal to S.

POJ2456 Aggressive cows

Description

Farmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,...,xN (0 <= xi <= 1,000,000,000).

背包问题详解

01 背包问题

问题描述

有 n 个重量和价值分别为 \(w_i\)\(v_i\) 的物品。从这些物品中挑选出总重量不超过 W 的物品,求所有挑选方案中价值总和的最大值。

最小生成树

给定一个无向图,如果它的某个子图中任意两个顶点都互相连通并且是一棵树,这棵树就叫做生成树,如果边上有权值,那么使得边权的生成树叫作最小生成树(MST)。

并查集

并查集是什么

并查集是一种用来管理元素分组情况的数据结构。并查集可以高效地进行如下操作:

  • 查询元素 a 和元素 b 是否属于同一组。
  • 合并元素 a 和元素 b 所在的组。

最短路径问题

最短路径即给定两个顶点,在一这两个点为起点和终点的路径中,边的权值和最小的路径。

POJ3614 Sunscreen

Description

To avoid unsightly burns while tanning, each of the C (1 ≤ C ≤ 2500) cows must cover her hide with sunscreen when they're at the beach. Cow i has a minimum and maximum SPF rating (1 ≤ minSPFi ≤ 1,000; minSPFimaxSPFi ≤ 1,000) that will work. If the SPF rating is too low, the cow suffers sunburn; if the SPF rating is too high, the cow doesn't tan at all........

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×