- 博客(43)
- 收藏
- 关注
原创 Halting Problem(2018 ACM/ICPC Asia Regional Qingdao Online)
In computability theory, the halting problem is the problem of determining, from a description of an arbitrary computer program, whether the program will finish running (i.e., halt) or continue to run...
2018-09-16 17:28:30
269
原创 Press the Button(2018 ACM/ICPC Asia Regional Qingdao Online)
BaoBao and DreamGrid are playing a game using a strange button. This button is attached to an LED light (the light is initially off), a counter and a timer and functions as follows:When the button i...
2018-09-16 17:24:32
398
原创 Tree(HDU - 6228)
Consider a un-rooted tree T which is not the biological significance of tree or plant, but a tree as an undirected graph in graph theory with n nodes, labelled from 1 to n. If you cannot understand th...
2018-08-22 22:31:28
194
原创 Ingredients(Gym - 101635E)
The chef of a restaurant aspiring for a Michelin star wants to display a selection of her signature dishes for inspectors. For this, she has allocated a maximum budget B for the cumulated cost, and sh...
2018-08-22 22:11:12
513
原创 Barricade(HDU - 5889)
Problem DescriptionThe empire is under attack again. The general of empire is planning to defend his castle. The land can be seen as N towns and M roads, and each road has the same length and connec...
2018-08-12 11:36:36
233
原创 Territorial Dispute(2017 ACM/ICPC Asia Regional Beijing Online)
In 2333, the C++ Empire and the Java Republic become the most powerful country in the world. They compete with each other in the colonizing the Mars.There are n colonies on the Mars, numbered from 1...
2018-08-09 21:06:09
178
原创 Cake(2017 ACM/ICPC Asia Regional Beijing Online)
To celebrate that WF-2018 will be held in PKU, Alice, Bob, and Cate are asked to make N cakes.Every cake i needs to go through 3 steps in restrict order:Alice mixes flour and water for ai minutes...
2018-08-09 20:51:48
231
原创 Minimum(2017 ACM/ICPC Asia Regional Beijing Online)
You are given a list of integers a0, a1, …, a2^k-1.You need to support two types of queries:Output Minx,y∈[l,r] {ax∙ay}.Let ax=y.InputThe first line is an integer T, indicating the number...
2018-08-09 20:30:43
162
原创 Visiting Peking University(2017 ACM/ICPC Asia Regional Beijing Online)
Ming is going to travel for n days and the date of these days can be represented by n integers: 0, 1, 2, …, n-1. He plans to spend m consecutive days(2 ≤ m ≤ n)in Beijing. During these m days, he inte...
2018-08-09 20:23:16
155
原创 Flow Problem(HDOJ-3549)
Problem DescriptionNetwork flow is a well-known difficult problem for ACMers. Given a graph, your task is to find out the maximum flow for the weighted directed graph.InputThe first line of in...
2018-08-02 11:27:18
160
原创 Stars Drawing (Hard Edition)(Codeforces-1015E2)
题目链接题意:给出一个n*m的图,四方向*的最大长度相同为一个星星,问能否找到不大于n*m颗星星,使得图中的所有*都被星星覆盖。思路:显然是一个搜索题,hard edition和easy edition的差别只有图的大小为1000*1000/300*300。 思路也很清晰,虽然题中说星星的数量不一定要最少,但由于不能大于n*m,所以干脆就求最少的星星数目,每次遇到*就搜出它四方向...
2018-08-01 01:15:32
668
1
原创 Walking Between Houses(Codeforces-1015D)
题目链接题意:在一条数轴上从从1~n排列着n座房子,每次必须移动,移动的距离为两点坐标之差的绝对值,问能否在k回合里一共移动s距离。思路:一道略带贪心的思维题,首先把k>s和k*(n-1)#pragma comment(linker, "/STACK:1024000000,1024000000")#include <vector>#includ
2018-08-01 01:04:37
569
原创 Fibonacci Tree(HDU - 4786)
Coach Pang is interested in Fibonacci numbers while Uncle Yang wants him to do some research on Spanning Tree. So Coach Pang decides to solve the following problem: Consider a bidirectional graph G w...
2018-07-30 12:26:19
189
原创 Searching(Gym - 100482I)
You have a simple system in which you want to have a search function. You decided to implement it for searching email addresses. There is a bunch of email addresses in your program. User enters an em...
2018-07-12 14:52:52
304
原创 FatMouse's Speed(HDOJ-1160)
Problem DescriptionFatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to take the data on a collection of mice and put as large a subset of this data as pos...
2018-07-10 11:10:42
112
原创 Fair(CodeForces - 986A)
题目:CLICK HERE题意:一共有n个城市分别生产k种商品,现在需要知道从每个城市出发至少得到s种不同的商品的最短距离。思路:第一次看还以为是最短生成树,但这样子可以求获得所有商品的最短距离而无法求得s种的。所以换一种思路,可以求第i个城市出发到第j个商品的最短距离。但这样子至少要n次搜索,n的数据最大为1e5明显会超时。 于是用一种巧妙的方法,看到种类的数目最大为100...
2018-07-07 16:44:27
230
原创 Sudoku Killer(HDOJ-1426)
Problem Description自从2006年3月10日至11日的首届数独世界锦标赛以后,数独这项游戏越来越受到人们的喜爱和重视。 据说,在2008北京奥运会上,会将数独列为一个单独的项目进行比赛,冠军将有可能获得的一份巨大的奖品———HDU免费七日游外加lcy亲笔签名以及同hdu acm team合影留念的机会。 所以全球人民前仆后继,为了奖品日夜训练茶饭不思。当然也包括初学者li...
2018-07-05 18:33:19
235
原创 Matrix (POJ-2155)
DescriptionGiven an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i, j] = 0 (1 <= i, j <= N). We can change th...
2018-06-22 15:02:26
133
原创 Quoit Design(HDOJ-1007)
Problem DescriptionHave you ever played quoit in a playground? Quoit is a game in which flat rings are pitched at some toys, with all the toys encircled awarded. In the field of Cyberground, the po...
2018-06-22 15:01:39
234
原创 Code for 1 (codeforces-768B)
Jon fought bravely to rescue the wildlings who were attacked by the white-walkers at Hardhome. On his arrival, Sam tells him that he wants to go to Oldtown to train at the Citadel to become a maester,...
2018-06-10 17:13:38
672
原创 Brackets (POJ-2955)
DescriptionWe give the following inductive definition of a “regular brackets” sequence:the empty sequence is a regular brackets sequence, if s is a regular brackets sequence, then (s) and [s] are...
2018-06-10 17:06:31
317
原创 Greatest Common Increasing Subsequence(HDOJ-1423)
Problem Description This is a problem from ZOJ 2432.To make it easyer,you just need output the length of the subsequence.Input Each sequence is described with M - its length (1 &lt;= M &lt;= 500) ...
2018-06-10 17:03:16
104
原创 Reward(HDOJ-2647)
Problem Description Dandelion’s uncle is a boss of a factory. As the spring festival is coming , he wants to distribute rewards to his workers. Now he has a trouble about how to distribute the reward...
2018-06-04 18:44:34
141
原创 Skiing(POJ - 3037)
Bessie and the rest of Farmer John’s cows are taking a trip this winter to go skiing. One day Bessie finds herself at the top left corner of an R (1 &amp;lt;= R &amp;lt;= 100) by C (1 &amp;lt;= C &amp;lt;= 100) grid ...
2018-05-31 22:58:17
427
1
原创 Ignatius and the Princess I(HDOJ-1026)
Problem Description The Princess has been abducted by the BEelzebub feng5166, our hero Ignatius has to rescue our pretty Princess. Now he gets into feng5166’s castle. The castle is a large labyrinth....
2018-05-29 10:03:28
187
原创 Fire Game(FZU - 2150)
Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start...
2018-05-26 13:53:01
266
原创 Huge Mission(FOJ-1608)
Oaiei is busy working with his graduation design recently. If he can not complete it before the end of the month, and he can not graduate! He will be very sad with that, and he needs your help. There ...
2018-05-25 13:14:54
322
原创 Balanced Lineup(POJ-3264)
DescriptionFor the daily milking, Farmer John’s N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with some of the cows. To...
2018-05-24 21:56:55
144
原创 Tree(HDOJ-2682)
今天还是复习图论。 一道最小生成树的题目,题目其实不难。 但一开始边的数目用的是MAXN*MAXN/2,MLE了一次,换vector之后不断地WA……结果上来看是因为没有用素数筛法,之前用的是这样的一个单独判断一个数是否是素数的办法,也是之前一直用的,不知道为什么这次不行。bool check(int x) { if (x == 2 || x == 3) return true...
2018-05-15 15:54:53
164
原创 小希的迷宫(HDOJ-1272)
前段时间心情比较丧,也没什么心情学习,最近好了点,先重新复习一下以前学的知识,今天做了道并查集的题。 Problem Description 上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以...
2018-05-14 22:00:25
161
原创 Slots of Fun
The International Betting Machine company has just issued a new type of slot machine. The machine display consists of a set of identical circles placed in a triangular shape. An example with four rows...
2018-04-11 16:39:39
193
原创 Very Simple Calculator
This problem doesn’t have a story. You just have to write a calculator which could perform simple binary operations. You will be given an expression and your program should calculate it’s result. Expr...
2018-04-11 16:35:24
165
原创 Dice Notation (ZOJ-3930)
Time Limit: 2 Seconds Memory Limit: 65536 KB...<Saika> I want to get some water from this strange lake. I have a bottle.<Keeper> OK.<Saika> Then I want to go forward to look int...
2018-04-05 07:22:09
317
原创 How Many Nines(ZOJ - 3950)
Time Limit: 1 Second Memory Limit: 65536 KBIf we represent a date in the format YYYY-MM-DD (for example, 2017-04-09), do you know how many 9s will appear in all the dates between Y1-M1-D1 and Y2-...
2018-04-03 11:07:34
178
原创 Seven-Segment Display(ZOJ - 3954)
Time Limit: 1 Second Memory Limit: 65536 KBA seven segment display, or seven segment indicator, is a form of electronic display device for displaying decimal numerals that is an alternative to th...
2018-04-03 11:01:17
280
原创 7-3 列出连通集(25 分)
给定一个有N个顶点和E条边的无向图,请用DFS和BFS分别列出其所有的连通集。假设顶点从0到N−1编号。进行搜索时,假设我们总是从编号最小的顶点出发,按编号递增的顺序访问邻接点。输入格式:输入第1行给出2个整数N(0<N≤10)和E,分别是图的顶点数和边数。随后E行,每行给出一条边的两个端点。每行中的数字之间用1空格分隔。输出格式:按照"{ v1 v2 ... vk }"的...
2018-03-28 20:15:05
1111
原创 7-1 列出叶结点(25 分)
7-1 列出叶结点(25 分)对于给定的二叉树,本题要求你按从上到下、从左到右的顺序输出其所有叶节点。输入格式:首先第一行给出一个正整数 N(≤10),为树中结点总数。树中的结点从 0 到 N−1 编号。随后 N 行,每行给出一个对应结点左右孩子的编号。如果某个孩子不存在,则在对应位置给出 "-"。编号间以 1 个空格分隔。输出格式:在一行中按规定顺序输出叶节点的编号。编号间以 1 个空格分隔,行...
2018-03-28 20:11:03
8904
2
原创 最强素数(100 分)
小李在你帮助之下轻松战胜了他的同学们,于是满怀恶意的同学出了一个题目来为难小李,作为小李神一样的队友,你又要出力了。 素数41能写成连续6个素数之和:41=2+3+5+7+11+13。 现在要求n以内的素数中,能表示为最多连续素数之和的那个数,如果有多个答案,请输出最大的那个素数。输入格式:仅一行,一个整数n。输出格式:输出就一个整数,为所求的能表示为最多连续素数和的那个素数。输入样例:100输...
2018-03-28 20:05:31
1399
原创 String Successor(ZOJ - 3490 )
The successor to a string can be calculated by applying the following rules: Ignore the nonalphanumerics unless there are no alphanumerics, in this case, increase the rightmost character in the st
2018-02-05 18:48:09
241
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人