- 博客(5)
- 收藏
- 关注
原创 简单搜索
题目大意是:你被困在一个地牢里,现在正在S点,需要走到E点。迷宫有多层,多行,多列,可以向上走,向下走,或者前后左右,求最短路,如果无法到达的话输出无解。这是一道经典的走迷宫问题,只不过从二维迷宫变成了拥有层数的三维迷宫,30^3的数据范围,用一般的深度优先搜索枚举路线是根本不可能了,所以使用广搜。只要将数组开成三维,方向增加了上下,增加了一个层数的队列。include <stdio.h>include <string.h>define M 50char dg[M][M][M
2021-02-08 23:35:40
282
原创 DFS算法
DFS(Depth-First-Search)深度优先搜索算法,属于搜索算法的一种。是一种在开发爬虫早期使用较多的方法。它的目的是要达到被搜索结构的叶结点。搜索原理深度优先搜索在搜索过程中访问某个顶点后,需要递归地访问此顶点的所有未访问过的相邻顶点,如果还存在未被发现的节点,则选择其中一个作为源节点并重复以上过程,整个进程反复进行直到所有节点都被访问为止,即运用的时找一个头结点,然后沿着这个头结点一直找下去,直到走到最后一个满足条件的分节点,然后再寻找另一条路径,当沿着一条路走不满足条件时会自动的跳入上
2021-01-17 21:57:40
2544
原创 Anniversary Cake
Problem DescriptionNahid Khaleh decides to invite the kids of the “Shahr-e Ghashang” to her wedding anniversary. She wants to prepare a square-shaped chocolate cake with known size. She asks each invited person to determine the size of the piece of cake t
2021-01-17 21:56:44
96
1
原创 Financial Management
Problem DescriptionLarry graduated this year and finally has a job. He’s making a lot of money, but somehow never seems to have enough. Larry has decided that he needs to grab hold of his financial portfolio and solve his financing problems. The first ste
2021-01-12 17:44:37
112
原创 汉字统计
Problem Description统计给定文本文件中汉字的个数。题解:汉字机内码的每个字节表示的十进制数都是负数,所以只需记录小于零的次数即可,汉字机内码在计算机中一般占二个字节所以统计结果要将t除以2.#include <stdio.h>#include <stdlib.h>#include<string.h>int main(){char a[200];int n,k,i,t;scanf("%d",&n);getchar();whi
2021-01-12 17:42:39
217
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人