现在位置: 首页 > 算法 > 文章
2017年06月07日 算法 ⁄ 共 2002字 评论关闭
Best Cow Line Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10605   Accepted: 3189 Description FJ is about to take his N (1 ≤ N ≤ 2,000) cows to the annual"Farmer of the Year" competition. In this contest every farmer arranges his cows in a line and herds them past the judges. The contest organizers adopted a new registration scheme this year: simply register the ini...
阅读全文
2017年06月07日 算法 ⁄ 共 2073字 评论关闭
Saruman's Army Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 4250   Accepted: 2183 Description Saruman the White must lead his army along a straight path from Isengard to Helm’s Deep. To keep track of his forces, Saruman distributes seeing stones, known as palantirs, among the troops. Each palantir has a maximum effective range of R units, and must be carried by so...
阅读全文
2017年06月06日 算法 ⁄ 共 2183字 评论关闭
Fence Repair Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 27280   Accepted: 8875 Description Farmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,000) planks of wood, each having some integer length Li (1 ≤ Li ≤ 50,000) units. He then purchases a single long board just long enough to...
阅读全文
2017年06月04日 算法 ⁄ 共 2464字 评论关闭
COURSES Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 15655   Accepted: 6185 Description Consider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task is to determine whether it is possible to form a committee of exactly P students that satisfies simultaneously the conditions:  every student in the committee represen...
阅读全文
2017年06月04日 算法 ⁄ 共 1056字 评论关闭
http://poj.org/problem?id=3041 最小覆盖: 最小覆盖要求用最少的点(X集合或Y集合的都行)让每条边都至少和其中一个点关联。 可以证明:最少的点(即覆盖数)=最大匹配数 M 简单的证明如下: (1)M个是足够的。只需要让它们覆盖最大匹配的M条边,则其它边一定被覆盖(如果有边e不被覆盖,把e加入后得到一个更大的匹配) (2)M个是必需的,仅考虑形成最大匹配的这M条边,由于它们两两之间没有公共点,因此至少需要M个点...
阅读全文
2017年06月04日 算法 ⁄ 共 1131字 评论关闭
排列 Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 14758 Accepted: 5988 Description 题目描述: 大家知道,给出正整数n,则1到n这n个数可以构成n!种排列,把这些排列按照从小到大的顺序(字典顺序)列出,如n=3时,列出1 2 3,1 3 2,2 1 3,2 3 1,3 1 2,3 2 1六个排列。 任务描述: 给出某个排列,求出这个排列的下k个排列,如果遇到最后一个排列,则下1排列为第1个排列,即排列1 2 3…n。...
阅读全文
2017年06月04日 算法 ⁄ 共 3444字 评论关闭
The Unique MST Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 17881 Accepted: 6204 Description Given a connected undirected graph, tell if its minimum spanning tree is unique. Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree of G is a subgraph of G, say T = (V', E'), with the following properties: 1. V' = V. 2. T is conne...
阅读全文
2017年06月04日 算法 ⁄ 共 2831字 评论关闭
TOYS Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 9018 Accepted: 4288 Description Calculate the number of toys that land in each bin of a partitioned toy box. Mom and dad have a problem - their child John never puts his toys away when he is finished playing with them. They gave John a rectangular box to put his toys in, but John is rebellious and obeys his parents by...
阅读全文
2017年06月04日 算法 ⁄ 共 2581字 评论关闭
Toy Storage Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3299 Accepted: 1887 Description Mom and dad have a problem: their child, Reza, never puts his toys away when he is finished playing with them. They gave Reza a rectangular box to put his toys in. Unfortunately, Reza is rebellious and obeys his parents by simply throwing his toys into the box. All the toys get m...
阅读全文
2017年06月03日 算法 ⁄ 共 2373字 评论关闭
    A Simple Problem with Integers   Time Limit: 5000MS Memory Limit: 131072K Total Submissions: 47665 Accepted: 14016 Case Time Limit: 2000MS Description You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for the sum of numbers in a given ...
阅读全文