搜索
TheWise_lzy
已毕业,社畜一枚
展开
-
TOJ 3287 Sudoku 9*9数独 dfs
描述Sudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 smaller squares 3x3 as shown on the Figure. In some of the cells are written decimal digits from 1 to 9. The ...原创 2018-11-28 10:02:04 · 278 阅读 · 0 评论 -
1091 Acute Stroke (30 分) 三维广搜bfs
One important factor to identify acute stroke (急性脑卒中) is the volume of the stroke core. Given the results of image analysis in which the core regions are identified in each MRI slice, your job is to c...原创 2019-08-12 20:50:06 · 174 阅读 · 0 评论 -
ACM 广搜 Knight Moves
寒假训练二里面的A题,搜了一下发现题库居然还有一题名字一样的。正好方法也差不多,所以顺便就一起写了。(广搜优先) TOJ 1133: Knight Moves 描述A friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest...原创 2017-02-03 19:36:57 · 492 阅读 · 0 评论 -
ACM 深搜&广搜 Counting Sheep&Space Exploration
数羊/牛/石油群类的,就是分堆的搜索。这里考虑用深搜or广搜,凭借题目给的地图范围,范围大的用广搜。 TOJ 2799 Counting Sheep A while ago I had trouble sleeping. I used to lie awake, staring at the ceiling, for hours and hours. Then one day ...原创 2017-02-04 15:06:01 · 1016 阅读 · 0 评论 -
ACM 广搜 Hero In Maze
这是Hero In Maze三道题,分别是TOJ中Hero In Maze简单版,普通版,提高版。以下我将一一阐述。 TOJ 2777 Hero In Maze简单版描述 500年前,Jesse是我国最卓越的剑客。他英俊潇洒,而且机智过人^_^。突然有一天,Jesse心爱的公主被魔王困在了一个巨大的迷宫中。Jesse听说这个消息已经是两天以后了,他急忙赶到迷宫,开始到处...原创 2017-02-07 14:55:29 · 1206 阅读 · 0 评论 -
ACM 广搜 贪吃蛇&&Maze
额最近做的好像都是广搜也...贪吃蛇是我很早以前就接触,现在才能看懂的..十分尴尬,然后这两题类型一样,我就写一起啦~都是四个方向,然后把走的方向存下来最后一起输出。 TOJ 3128 简单版贪吃蛇 描述 现在我们来简化蛇的身体,假设初始化的时候蛇的身体只有一个头而已(呵,当然是假设的),那么蛇去吃食物的时候就不必考虑碰到自己的身体了。例:5 5......原创 2017-02-07 21:09:30 · 611 阅读 · 0 评论 -
ACM 深搜 Seeding&Tempter of the Bone
暑期集训开始啦~因为是第一天,所以还没有正式开始讲座什么的,下午是一个小训练。题目主要是深搜广搜,难度不大,但是我为了以后日更垫个底,先更两题深搜压压惊~ ZOJ 2100 Seeding题目大意:S是不能走得,剩下的.要一笔画完,问是否可以实现。我的思路:一本正经的深搜啊,都写在备注里啦~ #include <stdio.h>char a[10...原创 2017-07-17 09:56:09 · 393 阅读 · 0 评论 -
ACM dfs回溯法 Prime Ring Problem
滴,集训第二天打卡。今天是紫书第七章训练+约瑟夫问题。约瑟夫问题就是一个公式可以解决的事情~~基本套路就是: #include <stdio.h>int main(){ int n,m,i,s=0; scanf("%d%d",&n,&m); for(i=2;i<=n;i++) s=(s+m)%i; printf("%d\n",s...原创 2017-07-18 16:35:50 · 426 阅读 · 0 评论 -
ACM 记忆化搜索 Function Run Fun & FatMouse and Cheese
滴,集训第四天打卡。今天是记忆化搜索和字典树...记忆话搜索可以举一反三..字典树看了一下午几乎是绝望的..所以下一篇会是字典树专题... POJ 1579 Function Run Fun题目大意及思路:用函数w(a,b,c)做递归,有四种情况如上述。这里很明显需要标记已经出现过的情况,即我代码中的m[x][y][z]可大幅度的减少递归时间。 #incl...原创 2017-07-20 19:31:17 · 409 阅读 · 0 评论 -
ACM 迭代深搜法 Power Calculus
滴,集训第五天打卡。今天是紫书第七章训练2,感觉难度很大呀...A和E是迭代深搜法,C是背包我首A的哈哈哈哈后续更新~这里贴E题.. UVA 1374 Power Calculus 题目大意:给定一个数n,让你求从1至少要做多少次乘除才可以从 x 得到 x^n。思路: 从小到大枚举深度上限,剪枝:(当每次取最大的两个数相加仍然小于n时要剪枝 。因为以最快的方式增...原创 2017-07-23 10:56:30 · 533 阅读 · 0 评论 -
L2-020. 功夫传人
L2-020. 功夫传人时间限制400 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者陈越一门武功能否传承久远并被发扬光大,是要看缘分的。一般来说,师傅传授给徒弟的武功总要打个折扣,于是越往后传,弟子们的功夫就越弱…… 直到某一支的某一代突然出现一个天分特别高的弟子(或者是吃到了灵丹、挖到了特别的秘笈),会将功夫的威力一...原创 2018-02-28 17:29:49 · 140 阅读 · 0 评论 -
天梯赛训练 六度空间(30 分)广搜
7-2 六度空间(30 分)“六度空间”理论又称作“六度分隔(Six Degrees of Separation)”理论。这个理论可以通俗地阐述为:“你和任何一个陌生人之间所间隔的人不会超过六个,也就是说,最多通过五个人你就能够认识任何一个陌生人。”如图1所示。图1 六度空间示意图“六度空间”理论虽然得到广泛的认同,并且正在得到越来越多的应用。但是数十年来,试图验证这个理论始终是许多...原创 2018-03-11 15:47:11 · 237 阅读 · 0 评论 -
天梯赛训练 列出连通集(25 分)
7-1 列出连通集(25 分)给定一个有N个顶点和E条边的无向图,请用DFS和BFS分别列出其所有的连通集。假设顶点从0到N−1编号。进行搜索时,假设我们总是从编号最小的顶点出发,按编号递增的顺序访问邻接点。输入格式:输入第1行给出2个整数N(0<N≤10)和E,分别是图的顶点数和边数。随后E行,每行给出一条边的两个端点。每行中的数字之间用1空格分隔。输出格式:按照"{ ...原创 2018-03-11 15:50:41 · 220 阅读 · 0 评论 -
TOJ3184 Mine sweeping dfs
3184: Mine sweeping 描述I think most of you are using system named of xp or vista or win7.And these system is consist of a famous game what is mine sweeping.You must have played it before.If you n...原创 2018-07-24 20:11:56 · 217 阅读 · 0 评论 -
TOJ 3287 Sudoku dfs
3287: Sudoku 描述 Sudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 smaller squares 3x3 as shown on the Figure. In some of the cells are written decimal digits...原创 2018-07-26 10:47:28 · 170 阅读 · 0 评论 -
TOJ 3432 Meteor Shower bfs
3432: Meteor Shower描述Bessie hears that an extraordinary meteor shower is coming; reports say that these meteors will crash into earth and destroy anything they hit. Anxious for her safety, she vow...原创 2018-07-26 13:30:51 · 134 阅读 · 0 评论 -
TOJ 1538 A Walk Through the Forest Spfa+DFS
1538: A Walk Through the Forest描述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 ma...原创 2018-07-30 21:01:14 · 150 阅读 · 0 评论 -
TOJ 4972: 数独 4*4 dfs
描述预计的周末天气非常不错,小T和小伙伴在满足的吃完烧烤后,玩起了数独。所谓数独就是在N*N的表格上填补数字,使得每行每列每块上都存在1~N这N个不同的数字。不过这是小T临时找的表格,所以只有4*4的大小。对于4*4的表格,它的每行上都应该含有1~4四个数字,每列上也含有1~4四个数字。然后将其分为4份2*2的小块,每个小块也含有1~4这4个数字。一个满足要求的数独表格如下所示: 1 ...原创 2018-11-28 10:33:55 · 1654 阅读 · 0 评论 -
1103 Integer Factorization (30 分) dfs 剪枝
TheK−Pfactorization of a positive integerNis to writeNas the sum of theP-th power ofKpositive integers. You are supposed to write a program to find theK−Pfactorization ofNfor any positive...原创 2019-08-12 21:51:15 · 113 阅读 · 0 评论