现在位置: 首页 > 算法 > 文章
2019年02月28日 算法 ⁄ 共 1461字 评论关闭
传送门 题意:给你一个有向图,如果任意的u和v能从一个点走到另一个点,那就yes,否则no。一开始理解错题意,以为既要从u能到v又要从v能到u,结果wa了几发。。。。。。。 思路:强连通,缩点,对于新点最多只能1个入度为0,也最多1个出度为0,并且这两个不能是同一点。 #include<iostream> #include<cstdio> #include<cstring> #include<stack> using namespace std; int t,n,m,fst[1005],next[7000]...
阅读全文
2019年02月28日 算法 ⁄ 共 1596字 评论关闭
Monthly Expense Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9834   Accepted: 4022 Description Farmer John is an astounding accounting wizard and has realized he might run out of money to run the farm. He has already calculated and recorded the exact amount of money (1 ≤ moneyi ≤ 10,000) that he will need to spend each day over the next N (1 ≤ N ≤ 100,000) days. FJ ...
阅读全文
2019年02月28日 算法 ⁄ 共 2028字 评论关闭
A Bug's Life Time Limit: 10000MS   Memory Limit: 65536K Total Submissions: 23202   Accepted: 7553 Description Background  Professor 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. In his experiment, individual bugs and their interactions were easy t...
阅读全文
2019年02月28日 算法 ⁄ 共 1283字 评论关闭
食物链 Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 33494   Accepted: 9736 Description 动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。  现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。  有人用两种说法对这N个动物所构成的食物链关系进行描述:  第一种说法是"1 X Y",表示X和Y是同类。  第二种说法是"2 X ...
阅读全文
2019年02月28日 算法 ⁄ 共 2421字 评论关闭
Wireless Network Time Limit: 10000MS   Memory Limit: 65536K Total Submissions: 13286   Accepted: 5618 Description An 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 network were all broken. The computers are repaired one by one, and th...
阅读全文
2019年02月28日 算法 ⁄ 共 5536字 评论关闭
Children of the Candy Corn Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7746   Accepted: 3357 Description The cornfield maze is a popular Halloween treat. Visitors are shown the entrance and must wander through the maze facing zombies, chainsaw-wielding psychopaths, hippies, and other terrors on their quest to find the exit.  One popular maze-walking strategy guaran...
阅读全文
2019年02月28日 算法 ⁄ 共 3005字 评论关闭
Relative Relatives Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 3330   Accepted: 1456 Description Today is Ted's 100th birthday. A few weeks ago, you were selected by the family to contact all of Ted's descendants and organize a surprise party. To make this task easier, you created an age-prioritized list of everyone descended from Ted. Descendants of the same age ...
阅读全文
2019年02月28日 算法 ⁄ 共 1453字 评论关闭
Holiday Hotel Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7757   Accepted: 3040 Description Mr. and Mrs. Smith are going to the seaside for their holiday. Before they start off, they need to choose a hotel. They got a list of hotels from the Internet, and want to choose some candidate hotels which are cheap and close to the seashore. A candidate hotel M meets two ...
阅读全文
2019年02月28日 算法 ⁄ 共 1315字 评论关闭
Sequence Sum Possibilities Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5434   Accepted: 3578 Description Most positive integers may be written as a sum of a sequence of at least two consecutive positive integers. For instance, 6 = 1 + 2 + 3 9 = 5 + 4 = 2 + 3 + 4 but 8 cannot be so written. Write a program which will compute how many different ways an input number m...
阅读全文
2019年02月27日 算法 ⁄ 共 1315字 评论关闭
Integer Intervals Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 11866   Accepted: 5007 Description An integer interval [a,b], a < b, is a set of all consecutive integers beginning with a and ending with b.  Write a program that: finds the minimal number of elements in a set containing at least two different integers from each interval. Input The first line of the...
阅读全文