&n
原创 2013-07-21 10:28:00
335阅读
Open the LockTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 655
原创 2022-08-05 11:25:00
80阅读
Problem Description Now an emergent task for you is to open a password lock. The password is consisted of four digits. Each digit is numbered from 1 to 9. Each time, you can add or minus 1 to any digit. When add 1 to '9', the digit will change to be '1' and when minus 1 to '1'
转载 2013-08-04 20:51:00
47阅读
2评论
Problem Description Now an emergent task for you is to open a password lock. The password is consisted of four digits. Each digit is numbered from 1 to 9. Each time, you can add or minus 1 to any digit. When add 1 to '9', the digit will change to be '1' and when minus 1 to '1'
转载 2013-08-03 21:31:00
69阅读
上回书说道,要用双向BFS来尝试一下。 最终AC了, 双向BFS,就是从两个点寻找一个共同的中间点。 然后把各自到这个中间点的步数加起来,及为最短
转载 2017-07-10 09:18:00
488阅读
2评论
原题链接: http://acm.hdu.edu.cn/showproblem.php?pid=1195一:题意的中间点。然后把各自到这个中间点的步数加起来
原创 2022-12-06 19:18:52
123阅读
http://acm.hdu.edu.cn/showproblem.php?pid=1195bfs 加1 减 1 交换 ,三个方式#include#include#include#include#include#include#include#include#include#include#include#include#include#inclu
原创 2023-03-03 12:49:31
66阅读
Open the Lock Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5970 Accepted Submission(s): 2666 P
原创 2021-07-21 15:36:52
61阅读
Open the LockTime Limit: 1000msMemory Limit: 32768KBThis problem will be judged onHDU. Original ID:119564-bit integer IO format:%I64d Java class name:...
转载 2014-08-29 18:10:00
48阅读
广搜……#include #include #include #include using namespace std; struct node { int num[4],step; }; node start,end; bool visit[10][10][10][10],flag; void bfs() { int i; node p,q; queue Q; memset(visit,false,sizeof(visit)); flag=true; start.step=0; p=star...
转载 2014-02-09 12:37:00
35阅读
2评论
题意:给定两个四位数,一个代表密码的初始状态,一个代表密码的开锁状态。对于四位数中的任意一位,可以将其减一或者加一,数字只是1到9,没有0,如果是1,要减一的话,就变成了9,相反,9要加一的话,就变成了1.还可以将两个相邻的位交换,但是最左的位不能和最右的位交换,最右和最左亦然。每改变一状态,最先
原创 2023-07-18 18:34:29
44阅读
Open the Lock Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4262    Accepted Submission(s): 1865 Pro
原创 2023-02-20 00:59:48
36阅读
Problem Description:Now an emergent task for you is to open a password lock. The password is consisted of four digits. Each digit is numbered from 1 to 9.Each time, you can add or minus 1 to any d...
原创 2023-05-09 10:01:28
96阅读
意甲冠军:给你一个初始4数字和目标4数字,当被问及最初的目标转换为数字后,。变换规则:每一个数字能够加1(9+1=1)或减1(1-1=9),或交换相邻的数字(最左和最右不是相邻的)。双向广搜:分别对初始和目标数字进行广搜,vis数组用1和2标记两种已搜索的数字,用mp数组记录状态的步数。当从前往后搜...
转载 2015-07-19 10:49:00
62阅读
2评论
题记:写这篇博客要主是加深自己对交换地方的认识和总结实现算法时的一些验经和训教,如果有错误请指出,万分感谢。标题址地: http://acm.hdu.edu.cn/showproblem.php?pid=1195一个标准的宽搜,一点不须要剪枝须要意注的一点是:交换的时候,这个地方只能交换街坊,我时当看错为以可以意任交换代码如下:每日一道理 人生是洁白的画纸,我们每个人就是手握各色笔的画师;人生也是一条看不到尽头的长路,我们每个人则是人生道路的远足者;人生还像是一块神奇的土地,我们每个人则是手握农具的耕耘者;但人生更像一本难懂的书,我们每个人则是孜孜不倦的读书郎。#include <ios
转载 2013-04-30 17:59:00
42阅读
2评论
刚学了个双向BFS,顺便用这题来练习练习,看看效果如何。先来个单向bfs
原创 2023-04-14 00:24:44
104阅读
题目地址:点击打开链接题意:给你一个初始的密码和最后的密码求从初始到最后所需的最少的步数,每位数字可以加1,减1,和交换,9
原创 2022-08-04 09:17:53
65阅读
二维树状数组View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxn 1030int c[maxn][maxn];int Row, Col, n;inline int Lowbit(const int &x){ return x & (-x);}int Sum(int i, int j){ int tempj, sum = 0; while (i > 0)
转载 2011-08-31 09:07:00
104阅读
2评论
AC自动机+状压dp 多串匹配要想ac自动机 dp[i][S]表示在i状态选中S 转移就用bfs,每个点通过fail收集信息,不要忘记通过fail传递 昨天搞不明白为什么自动机每次只可以转移儿子,不可以转移fail,问了问大概知道因为儿子是最长的后缀,包含的信息最多,包含了其他fail的信息,就相当
转载 2017-12-15 07:50:00
34阅读
2评论
Open the LockTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3014Accepted Submission(s): 1323 Problem Description Now an emergent task for you is to open a password lock. The password is consisted of four digits. Each digit is numbered from ...
转载 2013-08-03 21:52:00
59阅读
2评论
  • 1
  • 2
  • 3
  • 4
  • 5