欢迎来到PJCK的博客

随笔分类 -  数据结构与算法----图论----图的遍历、欧拉图、欧拉回路和图的基础题

摘要:7:欧拉回路 http://dsalgo.openjudge.cn/graph/7/ 7:欧拉回路 http://dsalgo.openjudge.cn/graph/7/ 描述 欧拉回路是指不令笔离开纸面,可画过图中每条边仅一次,且可以回到起点的一条回路 给定一个无向图,请判断该图是否存在欧拉回路 阅读全文
posted @ 2019-05-24 21:45 PJCK 阅读(478) 评论(0) 推荐(0)
摘要:Problem Description 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input 测试输入包含若干测 阅读全文
posted @ 2019-05-21 11:34 PJCK 阅读(198) 评论(0) 推荐(0)
摘要:【题目描述】 kotori有一个目标,要旅游遍全日本。 可惜日本太大了,她没有足够的经费。于是kotori计划游览n个地区。她从音乃木坂学院出发,希望把每条线路都走一遍,最后回到音乃木坂学院。 她认为走同一条路是愚蠢的,因此在规划旅游线路的时候不能在同一条路上经历两次。 n个地区之间共有m条线路。k 阅读全文
posted @ 2019-05-19 18:17 PJCK 阅读(155) 评论(0) 推荐(0)
摘要:题目描述: zyc从小就比较喜欢玩一些小游戏,其中就包括画一笔画,他想请你帮他写一个程序,判断一个图是否能够用一笔画下来。 规定,所有的边都只能画一次,不能重复画。 题目描述: zyc从小就比较喜欢玩一些小游戏,其中就包括画一笔画,他想请你帮他写一个程序,判断一个图是否能够用一笔画下来。 规定,所有 阅读全文
posted @ 2019-05-19 18:00 PJCK 阅读(214) 评论(0) 推荐(0)
摘要:【问题描述】 kotori在一个n*m迷宫里,迷宫的最外层被岩浆淹没,无法涉足,迷宫内有k个出口。kotori只能上下左右四个方向移动。她想知道有多少出口是她能到达的,最近的出口离她有多远? 【输入】 第一行为两个整数n和m,代表迷宫的行和列数 (1≤n,m≤30) 后面紧跟着n行长度为m的字符串来 阅读全文
posted @ 2019-05-17 22:40 PJCK 阅读(375) 评论(0) 推荐(0)
摘要:In a town, there are N people labelled from 1 to N. There is a rumor that one of these people is secretly the town judge. If the town judge exists, th 阅读全文
posted @ 2019-05-17 19:19 PJCK 阅读(108) 评论(0) 推荐(0)
摘要:There are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For example, if A is a direct 阅读全文
posted @ 2019-05-17 16:27 PJCK 阅读(246) 评论(0) 推荐(0)
摘要:There are N rooms and you start in room 0. Each room has a distinct number in 0, 1, 2, ..., N-1, and each room may have some keys to access the next r 阅读全文
posted @ 2019-05-17 09:56 PJCK 阅读(150) 评论(0) 推荐(0)
摘要:An image is represented by a 2-D array of integers, each integer representing the pixel value of the image (from 0 to 65535). Given a coordinate (sr, 阅读全文
posted @ 2019-05-16 20:58 PJCK 阅读(129) 评论(0) 推荐(0)
摘要:Given a 2D array A, each cell is 0 (representing sea) or 1 (representing land) A move consists of walking from one land square 4-directionally to anot 阅读全文
posted @ 2019-05-15 21:19 PJCK 阅读(133) 评论(0) 推荐(0)
摘要:迷宫问题 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 41913 Accepted: 23240 Description 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 阅读全文
posted @ 2019-05-15 13:08 PJCK 阅读(190) 评论(0) 推荐(0)
摘要:Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo 阅读全文
posted @ 2019-05-15 08:59 PJCK 阅读(152) 评论(0) 推荐(0)
摘要:Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, 阅读全文
posted @ 2019-05-05 14:30 PJCK 阅读(129) 评论(0) 推荐(0)
摘要:You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'. The wheels can rota 阅读全文
posted @ 2019-05-01 10:29 PJCK 阅读(175) 评论(0) 推荐(0)
摘要:Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacen 阅读全文
posted @ 2019-04-15 19:47 PJCK 阅读(147) 评论(0) 推荐(0)
摘要:题目背景 迷宫 【问题描述】 给定一个N*M方格的迷宫,迷宫里有T处障碍,障碍处不可通过。给定起点坐标和 终点坐标,问: 每个方格最多经过1次,有多少种从起点坐标到终点坐标的方案。在迷宫 中移动有上下左右四种方式,每次只能移动一个方格。数据保证起点上没有障碍。 输入样例 输出样例 【数据规模】 1≤ 阅读全文
posted @ 2019-03-20 18:50 PJCK 阅读(284) 评论(0) 推荐(0)