DFS,BFS
know_heng
步步皆题
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
HDU 5971 Wrestling Match(dfs)
Wrestling Match Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 266 Accepted Submission(s): 123 Problem Description Nowadays, at原创 2016-11-09 18:19:22 · 410 阅读 · 0 评论 -
HDU 5547 (模拟)
补全4*4的数独 代码: #include #include #include #include #include #include using namespace std; int a[40][40],sum; int hang[40][50],lie[40][50],f[20][20][50]; int jud(int i,int j,int k){ int h=(i原创 2017-04-25 17:15:39 · 351 阅读 · 0 评论 -
POJ 1143 (记忆化搜索,状态压缩,博弈论记忆化搜索实现)
Number Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3760 Accepted: 1557 Description Christine and Matt are playing an exciting game they just inv原创 2017-04-19 19:59:37 · 699 阅读 · 0 评论 -
hdu 1455 (DFS+剪枝)
George took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he forgot how many sticks he had orig原创 2017-04-06 16:01:39 · 354 阅读 · 0 评论 -
hdu 2918 Tobo or not Tobo(BFS+状态标记)
The game of Tobo is played on a plastic board designed into a 3 × 3 grid with cells numbered from 1 to 9 as shown in figure (a). The grid has four dials (labeled ``A" to ``D" in the figure.) Each dial原创 2017-04-06 14:07:33 · 483 阅读 · 0 评论 -
NYOJ 走迷宫(SPFA)
走迷宫 Time Limit: 1000ms Memory Limit: 128000KB 64-bit integer IO format: Java class name: Submit Status PID: 4918 Dr.Kong设计的机器人卡多非常爱玩,它常常偷偷跑出实验室,在某个游乐场玩之不疲。这天卡多又跑出来了,在SJTL游乐场玩原创 2017-04-14 20:29:54 · 602 阅读 · 1 评论 -
CF 208B Solitaire (记忆化搜索)
Description A boy named Vasya wants to play an old Russian solitaire called "Accordion". In this solitaire, the player must observe the following rules: A deck of n cards is carefully shuffled,原创 2017-04-13 09:07:27 · 541 阅读 · 0 评论 -
HDU 5323(DFS)
Have you learned something about segment tree? If not, don’t worry, I will explain it for you. Segment Tree is a kind of binary tree, it can be defined as this: - For each node u in Segment Tree,原创 2017-04-03 18:21:55 · 325 阅读 · 0 评论 -
HDU 1142 A Walk Through the Forest (SPFA+记忆化DFS)
Jimmy experiences a lot of stress at work these days, especially since his accident made working difficult. To relax after a hard day, he likes to walk home. To make things even nicer, his office is o原创 2017-04-11 16:16:37 · 245 阅读 · 0 评论 -
CodeForces - 776D The Door Problem
Moriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the doors ar原创 2017-04-11 15:10:12 · 415 阅读 · 0 评论 -
CodeForces - 275B (广搜)
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black原创 2017-04-07 16:45:12 · 532 阅读 · 0 评论 -
POJ 2255(已知前中序遍历 还原树)
Little Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capital letters in the nodes. This is an example of one of her creat原创 2017-04-07 10:35:34 · 323 阅读 · 0 评论 -
已知二叉树的中序前序遍历,还原树结构+层次遍历
L2-011. 玩转二叉树 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 给定一棵二叉树的中序遍历和前序遍历,请你先将树做个镜面反转,再输出反转后的层序遍历的序列。所谓镜面反转,是指将所有非叶结点的左原创 2017-03-22 20:51:45 · 853 阅读 · 0 评论 -
PREV-33 兰顿蚂蚁 (DFS)
问题描述 兰顿蚂蚁,是于1986年,由克里斯·兰顿提出来的,属于细胞自动机的一种。 平面上的正方形格子被填上黑色或白色。在其中一格正方形内有一只“蚂蚁”。 蚂蚁的头部朝向为:上下左右其中一方。 蚂蚁的移动规则十分简单: 若蚂蚁在黑格,右转90度,将该格改为白格,并向前移一格; 若蚂蚁在白格,左转90度,将该格改为黑格,并向前移一格。原创 2017-03-11 09:06:09 · 295 阅读 · 0 评论 -
POJ 1038(状态压缩DP)
Bugs Integrated, Inc. Time Limit: 15000MS Memory Limit: 30000K Total Submissions: 10080 Accepted: 3884 Case Time Limit: 5000MS Description Bugs Integrated, Inc.原创 2016-11-24 18:52:41 · 506 阅读 · 0 评论 -
双向BFS
双向广搜,:使出发点和目标点同时添加到队列里搜索,一旦有相同点则结束搜索。 代码: #include struct ST{ int x,y,s,t; }re[100],fr[100]; int head1=0,head2=0,tail1=0,tail2=0; int Judge(int x,int y,int head,int tail,struct ST a[]){ for(int i=原创 2017-03-18 09:17:14 · 212 阅读 · 0 评论 -
玲珑杯 C -- Coco
C -- Coco Time Limit:1s Memory Limit:64MByte Submissions:262Solved:125 DESCRIPTION Coco just learned a math operation call mod.Now,there is an integer aa and nn integers原创 2016-11-26 19:25:00 · 289 阅读 · 0 评论 -
HDU 6035 Colorful Tree (树形DP,dfs)
Problem Description There is a tree with n nodes, each of which has a type of color represented by an integer, where the color of node i is ci. The path between each two different nodes is uni原创 2017-07-28 14:20:16 · 268 阅读 · 0 评论
分享