
千题计划
文章平均质量分 73
ryan0wang
while (!success()) try();
展开
-
【Codevs1078】最小生成树 Prim算法(5/1000)
DescriptionFarmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs your help, of course.Farmer John ordered a原创 2017-11-28 19:00:31 · 244 阅读 · 0 评论 -
【HDU4614 Vases ans Flowers】线段树+二分
DescrptionAlice is so popular that she can receive many flowers everyday. She has N vases numbered from 0 to N-1. When she receive some flowers, she will try to put them in the vases, one flower in ...原创 2018-04-25 15:29:23 · 216 阅读 · 0 评论 -
【HDU3974]Assign the task dfs序或欧拉序+线段树
descriptionThere is a company that has N employees(numbered from 1 to N),every employee in the company has a immediate boss (except for the leader of whole company).If you are the immediate boss o...原创 2018-04-23 20:11:06 · 237 阅读 · 0 评论 -
[kuangbin带你飞]专题一 简单搜索 (17/1000)
终于,做完了kuangbin大神带你飞的专题一之简单搜索,实在有一股无法言喻的感觉,每道题类型都差不多但细节实现却有点细微区别,所以14道题我就只当作5题了。。棋盘问题稍微变了点形的皇后问题,不能一行一行搜索,要一个一个格子搜索include <cstdio>#include <cstring>#include <iostream>#include <algorithm>using name原创 2017-12-13 20:34:54 · 698 阅读 · 0 评论 -
【Aizu-ALDS1_7_B】Binary Trees 树 (4/1000)
DescriptionA rooted binary tree is a tree with a root node in which every node has at most two children.Your task is to write a program which reads a rooted binary tree T and prints the following原创 2017-11-27 15:51:25 · 306 阅读 · 0 评论 -
【Codevs1174】 靶形数独 启发式搜索 (10/1000)
Description小城和小华都是热爱数学的好学生,最近,他们不约而同地迷上了数独游戏,好胜的他 们想用数独来一比高低。但普通的数独对他们来说都过于简单了,于是他们向Z 博士请教, Z 博士拿出了他最近发明的“靶形数独”,作为这两个孩子比试的题目。靶形数独的方格同普通数独一样,在 9 格宽×9 格高的大九宫格中有9 个3 格宽×3 格 高的小九宫格(用粗黑色线隔开的)。在这个大九宫格中,有一原创 2017-12-06 00:11:32 · 570 阅读 · 0 评论 -
【Codevs1041】Car的旅行路线 Floyd 简单几何 (9/1000)
Description又到暑假了,住在城市A的Car想和朋友一起去城市B旅游。她知道每个城市都有四个飞机场,分别位于一个矩形的四个顶点上,同一个城市中两个机场之间有一条笔直的高速铁路,第I个城市中高速铁路了的单位里程价格为Ti,任意两个不同城市的机场之间均有航线,所有航线单位里程的价格均为t。 那么Car应如何安排到城市B的路线才能尽可能的节省花费呢?她发现这并不是一个简单的问题,于是她来向你请教原创 2017-12-05 23:48:46 · 219 阅读 · 0 评论 -
【UVA439】 Knight Moves BFS (3/1000)
DescriptionA friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tour of knight moves that visits each square of a given set of n squares on原创 2017-11-26 14:49:32 · 255 阅读 · 0 评论 -
【UVA548】Tree 建树+深搜 (2/1000)
DescriptionYou are to determine the value of the leaf node in a given binary tree that is the terminal node of a path of least value from the root of the binary tree to any leaf. The value of a path原创 2017-11-26 09:48:10 · 261 阅读 · 0 评论 -
【Codevs1225】 八数码难题 BFS (1/1000)
很经典的一道题,我用的是宽度优先搜索,set判重,本来这题可以用康托展开和逆展开,再开一个大数组,判重可做到O(1)的时间复杂度,这里偷一个懒,直接将数组变成了一个9位数,统统丢set去判重,set查找效率还是很高的,毕竟红黑树,这里还顺便复习了一下结构体的初始化,每个结构体都代表一个状态,每个状态储存着一个9位数,步数,空格位置,似乎每一个都是必须。#include<cstdio>#includ原创 2017-11-25 12:18:37 · 217 阅读 · 0 评论 -
【POJ2251】Dungeon Master 三维 BFS Hash(12/1000)
DescriptionYou are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit no原创 2017-12-08 12:17:25 · 288 阅读 · 0 评论 -
【Codevs1282】 约瑟夫问题 树状数组 (11/1000)
Description有编号从1到N的N个小朋友在玩一种出圈的游戏。开始时N个小朋友围成一圈,编号为I+1的小朋友站在编号为I小朋友左边。编号为1的小朋友站在编号为N的小朋友左边。首先编号为1的小朋友开始报数,接着站在左边的小朋友顺序报数,直到数到某个数字M时就出圈。直到只剩下1个小朋友,则游戏完毕。现在给定N,M,求N个小朋友的出圈顺序。Input唯一的一行包含两个整数N,M。(1<=N,M<=3原创 2017-12-06 13:26:57 · 448 阅读 · 0 评论 -
【Codevs1163】访问艺术馆 树形dp 记忆化搜索(8/1000)
Description皮尔是一个出了名的盗画者,他经过数月的精心准备,打算到艺术馆盗画。艺术馆的结构,每条走廊要么分叉为二条走廊,要么通向一个展览室。皮尔知道每个展室里藏画的数量,并且他精确地测量了通过每条走廊的时间,由于经验老道,他拿下一副画需要5秒的时间。你的任务是设计一个程序,计算在警察赶来之前(警察到达时皮尔回到了入口也算),他最多能偷到多少幅画。 Input第1行是警察赶到得时间,以s为原创 2017-11-29 22:39:44 · 213 阅读 · 0 评论 -
【Codevs1001】舒适的路线 并查集 枚举 比值 (7/1000)
DescriptionZ小镇是一个景色宜人的地方,吸引来自各地的观光客来此旅游观光。 Z小镇附近共有N(1Input第一行包含两个正整数,N和M。 接下来的M行每行包含三个正整数:x,y和v(1≤x,y≤N,0 最后一行包含两个正整数s,t,表示想知道从景点s到景点t最大最小速度比最小的路径。s和t不可能相同。Output如果景点s到景点t没有路径,输出“IMPOSSIBLE”。否则输出一个数,原创 2017-11-29 00:01:47 · 264 阅读 · 0 评论 -
【Codevs1074】 食物链 并查集 平行世界 (6/1000)
Description动物王国中有三类动物 A,B,C,这三类动物的食物链构成了有趣的环形。A吃B,B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是“1 X Y”,表示X和Y是同类。 第二种说法是“2 X Y”,表示X吃Y。 此人对N个动物,原创 2017-11-28 20:07:05 · 201 阅读 · 0 评论 -
Leetcode Weekly Contest 88
848.字母移位 题目大意:给出一个字符串,每个前缀的移位次数,求最终的字符串 题解:每个字母的移位次数其实就是后缀和class Solution {public: string shiftingLetters(string S, vector<int>& shifts) { if (shifts.size()==0) return S;...原创 2018-06-11 13:29:39 · 233 阅读 · 0 评论