随笔分类 - 02.搜索 - (1)BFS
摘要:题目链接:http://codeforces.com/problemset/problem/677/D 题意: 有 的网格,每个网格上有一个棋子,棋子种类为 ,棋子的种类数为 。 现在出发点为 ,必须按照种类 进行
阅读全文
摘要:题目链接:传送门 描述 给定一张N个点M条边的有向无环图,分别统计从每个点出发能够到达的点的数量。N,M≤30000。 输入格式 第一行两个整数N,M,接下来M行每行两个整数x,y,表示从x到y的一条有向边。 输出格式 共N行,表示每个点能够到达的点的数量。 样例输入 样例输出 题解: 首先,如果用
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2612 Problem DescriptionPass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally.
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3085 Problem DescriptionLast night, little erriyue had a horrible nightmare. He dreamed that he and his
阅读全文
摘要:题目链接:传送门 描述 Ha'nyu是来自异世界的魔女,她在漫无目的地四处漂流的时候,遇到了善良的少女Rika,从而被收留在地球上。Rika的家里有一辆飞行车。有一天飞行车的电路板突然出现了故障,导致无法启动。电路板的整体结构是一个R行C列的网格(R,C≤500),如右图所示。每个格点都是电线的接点
阅读全文
摘要:题目链接: http://poj.org/problem?id=2513 http://bailian.openjudge.cn/practice/2513?lang=en_US Time Limit: 5000MS Memory Limit: 128000K Description You are
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1241 题意: 求某块平面上,连通块的数量。一个油田格子若周围八个方向也有一个油田格子,则认为两者相连通。 AC代码:
阅读全文
摘要:题目链接:http://poj.org/problem?id=3984 Description 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0
阅读全文
摘要:题目链接:https://cn.vjudge.net/problem/UVA-11624 题意: 给出一个 的矩阵,上面有的格子能走,有的格子是墙不能走。 有若干个点是火源,火每分钟都往上下左右蔓延一格(不能越墙)。又给出一个点是Joe的出发点,他只要能在不碰到火的前提下走
阅读全文
摘要: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 con
阅读全文
摘要:题目链接:http://poj.org/problem?id=3414 Time Limit: 1000MS Memory Limit: 65536K Description You are given two pots, having the volume of A and B liters re
阅读全文
摘要:题目链接:http://poj.org/problem?id=3126 题意: 给定两个四位素数 ,要求把 变换到 。变换的过程每次只能改动一个数,要保证每次变换出来的数都是一个没有前导零的四位素数。 要求每步得到的素数都不能重复,求从 到 最少需要变换多少步
阅读全文
摘要:题目链接:http://poj.org/problem?id=1426 Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation con
阅读全文
摘要:题目链接:http://poj.org/problem?id=3278 Description Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He
阅读全文
摘要:题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3781 Time Limit: 2 Seconds Memory Limit: 65536 KB Leo has a grid with N rows and M c
阅读全文
摘要:题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=2444 Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Des
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1495 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Descripti
阅读全文
摘要:Description You 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 fille
阅读全文
摘要:题目链接:http://hihocoder.com/problemset/problem/1322 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 给定一个包含 N 个顶点 M 条边的无向图 G ,
阅读全文
摘要:1 #include<cstdio> 2 #include<queue> 3 #include<cstring> 4 using namespace std; 5 int n,m,mv;char map[103][103];bool vis[103][103]; 6 struct type{ 7 i
阅读全文