- HDUOJ-1015 Safecracker(深搜)
叽翅
深搜依旧是DFS。题的用语简直不要太美国本土化,尽管公式以及前后两句就足以明白题意,少一句话不明白都不得劲。。半个多小时用来完整翻译。。解题核心-深搜函数递归结构,开头判断结束条件-将字符串排序再搜索,因为需要字典序最大的结果翻译ProblemDescription==="高科技简报",2002/11/0206:42美国中部时间==="该物品被锁在二楼图书馆的一幅画后面的克莱因保险箱里。克莱因保险
- hdoj 1015 Safecracker(窃贼) Dfs
久石_giao
acm_搜索
题目真是啰嗦=-=(A=1,B=2,...,Z=26)v-w^2+x^3-y^4+z^5=target输入:tarrget+一段字符串输出:满足条件的字符串(多个按字典序)#include#include#include#include#defineres(v,w,x,y,z)v-w*w+x*x*x-y*y*y*y+z*z*z*z*zusingnamespacestd;intnum[5][30],
- Safecracker HDU - 1015 (搜索)
渣渣本扎
日常训练
===Optechbriefing,2002/11/0206:42CST==="TheitemislockedinaKleinsafebehindapaintinginthesecond-floorlibrary.Kleinsafesareextremelyrare;mostofthem,alongwithKleinandhisfactory,weredestroyedinWorldWarII.F
- HDU 1015 Safecracker ( DFS )
zonas.wang
[ACM][ACM]_搜索深度优先搜索DFS简单DFS记忆化搜索
SafecrackerTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):13280AcceptedSubmission(s):6923ProblemDescription===Optechbriefing,2002/11/0206:42CST==="Theitemisl
- DFS经典题目详解
有所为,无所畏
【洛谷】P1605迷宫【洛谷】P1101单词方阵【洛谷】P1219八皇后【HDU】2563统计问题【HDU】1035RobotMotion【HDU】1045FireNet【HDU】1010TempteroftheBone(奇偶剪枝)【HDU】1015Safecracker【HDU】1016PrimeRingProblem【HDU】1258SumItUp(去重技巧)【POJ】2676Sudoku(数
- 【DFS 排列与组合的简单搜索】Safecracker [HDU 1015]
溢流眼泪
DFS排列与组合的简单搜索链接:Safecracker题意:一个char的映射:(A=1,B=2,…,Z=26).从一个给定的string里选取五个字符,给定target,求v-w^2^+x^3^-y^4^+z^5^=target要求vwxyz字典序最大题目先摆着里,可以思考一下!这里讲两种简单的DFS搜索DFS与组合这类题目是,求n个数(nn)return;//边界3if(10-pos+now>
- Safecracker(HD1015)dfs
pm12137
#搜索
链接:http://acm.hdu.edu.cn/showproblem.php?pid=1015思路:深度优先搜索,要注意的是先给字符串进行排序,然后从后往前找,这样就能第一个就找到符合题意的。代码:#include#include#include#include#include#includeusingnamespacestd;inttarget,len,flag;charstr[15],re
- Safecracker(暴力)
御史大夫
ACM题解
SafecrackerTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):5240AcceptedSubmission(s):2622ProblemDescription===Optechbriefing,2002/11/0206:42CST==="Theitemislo
- HDOJ(HDU).1241 Oil Deposits(DFS)
pengwill97
算法---搜索
HDOJ(HDU).1241OilDeposits(DFS)[从零开始DFS(5)]点我挑战题目从零开始DFSHDOJ.1342Lotto[从零开始DFS(0)]—DFS思想与框架/双重DFSHDOJ.1010TempteroftheBone[从零开始DFS(1)]—DFS四向搜索/奇偶剪枝HDOJ(HDU).1015Safecracker[从零开始DFS(2)]—DFS四向搜索变种HDOJ(HD
- HDOJ
qiao-er
算法
文章目录#1003MaxSum#1004LettheBalloonRise#1005NumberSequence#1008Elevator#1012uCalculatee#1013DigitalRoots#1015Safecracker#1017AMathematicalCuriosity#1018BigNumber#1019LeastCommonMultiple#1021FibonacciAga
- hdu 汇总題解
穆梓先生
1004LettheBalloonRisemap特别方便1013DigitalRoots大数+余九定理。用字符串输入,每个字符转换为整数,求和,最后带入(n-1)%9+1.1015Safecracker题意是:给你一个值,求满足表达式的字母,相同时升序优先暴力枚举:先排序(降序),五个for循环枚举每一个字母,不能有重复的1017AMathematicalCuriosity求满足表达式的个数,注意
- Safecracker 分类: HDU 搜索 ...
weixin_30765577
SafecrackerTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):10165AcceptedSubmission(s):5213ProblemDescription===Optechbriefing,2002/11/0206:42CST===“Theitemisl
- HDU:1015 Safecracker哈哈,这样…
inlcude_cx
杭电ACM题解题报告
纯粹的暴力解决,用了五个for循环,本来没抱多大希望的,以为会有更好的算法来解决这个问题的,但是竟然能过,真是太出乎我的意料了,有点儿小激动!这个题是完全的暴力解决,就是从字符串里面找到五个字符他的序号带入公式v-w^2+x^3-y^4+z^5等于前面的那个数,然后按照字典序输出最后面的那个就行了,拥护暴力!!!#include#include#includeinttarget(inta,intb
- 杭电-1015Safecracker(DFS)
Eric_keke
深度优先搜索HDU—ACM
SafecrackerTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):10906AcceptedSubmission(s):5584ProblemDescription===Optechbriefing,2002/11/0206:42CST==="Theitemisl
- 黑客术语
患上中二病
白帽黑客,那些用自己的黑客技术来维护网络关系公平正义的黑客,白帽子一般有清楚的定义、道德规范并常常试图同企业合作去改善发现的安全弱点。灰帽黑客,是指对于伦理和法律态度不明确的黑客。黑帽黑客,经常用来区别于一般(正面的)理性的黑客。这个词自1983年开始流行,大概是由于采用了音译,结合safecracker的含义,化为一个犯罪和黑客的合成词。黑客,最早源自英文hacker,他们都是水平高超的电脑专家
- 搜索+枚举字符串子串问题
Exchan
OJ题解
求字符串的子串问题有两类,一种是不连续,一种是连续。然而这两种都可以用暴力求解,不过容易timelimitedexceed;那可以只用两个for循环就get全部子串吗?求不连续的子串:用DFS(深度优先搜索)这里看一个题HD1015Safecracker这个题大意就是在给出的5-12个字符里面找到字典序最大的子串(不连续),子串字符数目是5个,且子串满足公式v-w^2+x^3-y^4+z^5=ta
- hdu1016 Prime Ring Problem dfs 素数打表
fruit_dish
oj题解
意思是给你一个数n,要构成一个素数环,这个素数由1-n组成,它的特征是选中环上的任意一个数字i,i与它相连的两个数加起来都分别为素数,满足就输出。这个题的做法和hdu1015做法差不多都是使用dfs回溯。不同之处在于这个要全部搜索,而hdu1015只需要搜索第一组就可以。其次在这个题目中使用素数打表的方式简化素数判定,在一定情况下也是对效率有所提高的。PrimeRingProblemTimeLim
- HDU 1015 Safecracker
大烁就是要吃肉
ACM暴力枚举
SafecrackerProblemDescription===Optechbriefing,2002/11/0206:42CST==="TheitemislockedinaKleinsafebehindapaintinginthesecond-floorlibrary.Kleinsafesareextremelyrare;mostofthem,alongwithKleinandhisfactor
- HDOJ/HDU 1015 Safecracker(深搜)
qq_26525215
ProblemDescription===Optechbriefing,2002/11/0206:42CST===“TheitemislockedinaKleinsafebehindapaintinginthesecond-floorlibrary.Kleinsafesareextremelyrare;mostofthem,alongwithKleinandhisfactory,weredestr
- HDOJ/HDU 1015 Safecracker(枚举、暴力)
qq_26525215
ProblemDescription===Optechbriefing,2002/11/0206:42CST===“TheitemislockedinaKleinsafebehindapaintinginthesecond-floorlibrary.Kleinsafesareextremelyrare;mostofthem,alongwithKleinandhisfactory,weredestr
- HDU 1015 Safecracker (DFS)
liangzhaoyang1
DFSHDUSafecracker1015
SafecrackerTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):12192 AcceptedSubmission(s):6315ProblemDescription===Optechbriefing,2002/11/0206:42CST==="Th
- hdu 1015 Safecracker
chen_ze_hua
hash
题目大意输入一个数字和一个字符串,字符串中的每个字母代表一个数字,问能否用这些数字的组合得到满足公式v-w^2+x^3-y^4+z^5=target的解。题目解法这道题我用了hash表的思想,将字母hash成对应的数字,然后不断枚举得到一个满足解就可以了,因为要求字典序最大,所以要从大到小枚举。因为最多26的字母,5次循环不会超时,暴力就可以了。因为要找到一个解就行了,所以要跳出5重循环,我使用了
- HDU 1015 Safecracker(一道很好的dfs)
Sxx312
题意:输入一个target和一个字符串,字符串每一个字母应1~26个数字,在字符串中找出5个字母能满足v-w^2+x^3-y^4+z^5=target,如果能找到输出这5个字符,如果不能输出nosolution题目地址点击打开链接思路:很容易想到暴力搜索,把每种组合都实验一遍直到找到满足条件的第一组数据Code:#include
#include
#include
#include
#includ
- HDU - 1015 Safecracker
qq_28300479
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1015#include
#include
#include
#include
#defineres(v,w,x,y,z)v-w*w+x*x*x-y*y*y*y+z*z*z*z*z
usingnamespacestd;
/******************************************
- HDU1015Safecracker
wsn564533648
ACM
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1015看代码就知道这道题有多水代码:#include#include#includeusingnamespacestd;chars[20];inttarget;inta[20];boolcmp(inta,intb){ returna>b;}intmain(){ while(~scanf("%d%
- hdu 1015 Safecracker
lucky_少哖
SafecrackerTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):11575 AcceptedSubmission(s):5965ProblemDescription===Optechbriefing,2002/11/0206:42CST==="Th
- HDU 1015 Safecracker
闪耀子
破解密码把字符串从大到小排序,5个循环,验证目标函数a-b*b+c*c*c-d*d*d*d+e*e*e*e*e==m为真时得到字符串结束循环输出1#include
2#include
3#include
4#include
5usingnamespacestd;
6
7intcompare(constvoid*a,constvoid*b){
8return*(char*)b-*(ch
- HDU 1015 Safecracker(第一次用了搜索去遍历超时,第二次用for循环可以了,思路一样的)
xky1306102chenhong
SafecrackerTimeLimit:2000/1000ms(Java/Other) MemoryLimit:65536/32768K(Java/Other)TotalSubmission(s):3 AcceptedSubmission(s):1ProblemDescription===Optechbriefing,2002/11/0206:42CST==="Theitemislock
- HDU1015Safecracker
qq_32866009
枚举
话不多说,,,简单的枚举类型题目,,,暴力过的,,以后有好的方法还会与大家分享代码附上:usingnamespacestd;charcmp(chara,charb){returna>b;}intmain(){inttarget;chara[105];while(~scanf(“%d”,&target)){scanf(“%s”,a);intl=strlen(a),flag=0;if(target==
- hdu 1015 Safecracker
rack
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1882 Accepted Submission(s): 996
&
- html页面js获取参数值
0624chenhong
html
1.js获取参数值js
function GetQueryString(name)
{
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = windo
- MongoDB 在多线程高并发下的问题
BigCat2013
mongodbDB高并发重复数据
最近项目用到 MongoDB , 主要是一些读取数据及改状态位的操作. 因为是结合了最近流行的 Storm进行大数据的分析处理,并将分析结果插入Vertica数据库,所以在多线程高并发的情境下, 会发现 Vertica 数据库中有部分重复的数据. 这到底是什么原因导致的呢?笔者开始也是一筹莫 展,重复去看 MongoDB 的 API , 终于有了新发现 :
com.mongodb.DB 这个类有
- c++ 用类模版实现链表(c++语言程序设计第四版示例代码)
CrazyMizzz
数据结构C++
#include<iostream>
#include<cassert>
using namespace std;
template<class T>
class Node
{
private:
Node<T> * next;
public:
T data;
- 最近情况
麦田的设计者
感慨考试生活
在五月黄梅天的岁月里,一年两次的软考又要开始了。到目前为止,我已经考了多达三次的软考,最后的结果就是通过了初级考试(程序员)。人啊,就是不满足,考了初级就希望考中级,于是,这学期我就报考了中级,明天就要考试。感觉机会不大,期待奇迹发生吧。这个学期忙于练车,写项目,反正最后是一团糟。后天还要考试科目二。这个星期真的是很艰难的一周,希望能快点度过。
- linux系统中用pkill踢出在线登录用户
被触发
linux
由于linux服务器允许多用户登录,公司很多人知道密码,工作造成一定的障碍所以需要有时踢出指定的用户
1/#who 查出当前有那些终端登录(用 w 命令更详细)
# who
root pts/0 2010-10-28 09:36 (192
- 仿QQ聊天第二版
肆无忌惮_
qq
在第一版之上的改进内容:
第一版链接:
http://479001499.iteye.com/admin/blogs/2100893
用map存起来号码对应的聊天窗口对象,解决私聊的时候所有消息发到一个窗口的问题.
增加ViewInfo类,这个是信息预览的窗口,如果是自己的信息,则可以进行编辑.
信息修改后上传至服务器再告诉所有用户,自己的窗口
- java读取配置文件
知了ing
1,java读取.properties配置文件
InputStream in;
try {
in = test.class.getClassLoader().getResourceAsStream("config/ipnetOracle.properties");//配置文件的路径
Properties p = new Properties()
- __attribute__ 你知多少?
矮蛋蛋
C++gcc
原文地址:
http://www.cnblogs.com/astwish/p/3460618.html
GNU C 的一大特色就是__attribute__ 机制。__attribute__ 可以设置函数属性(Function Attribute )、变量属性(Variable Attribute )和类型属性(Type Attribute )。
__attribute__ 书写特征是:
- jsoup使用笔记
alleni123
java爬虫JSoup
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.7.3</version>
</dependency>
2014/08/28
今天遇到这种形式,
- JAVA中的集合 Collectio 和Map的简单使用及方法
百合不是茶
listmapset
List ,set ,map的使用方法和区别
java容器类类库的用途是保存对象,并将其分为两个概念:
Collection集合:一个独立的序列,这些序列都服从一条或多条规则;List必须按顺序保存元素 ,set不能重复元素;Queue按照排队规则来确定对象产生的顺序(通常与他们被插入的
- 杀LINUX的JOB进程
bijian1013
linuxunix
今天发现数据库一个JOB一直在执行,都执行了好几个小时还在执行,所以想办法给删除掉
系统环境:
ORACLE 10G
Linux操作系统
操作步骤如下:
第一步.查询出来那个job在运行,找个对应的SID字段
select * from dba_jobs_running--找到job对应的sid
&n
- Spring AOP详解
bijian1013
javaspringAOP
最近项目中遇到了以下几点需求,仔细思考之后,觉得采用AOP来解决。一方面是为了以更加灵活的方式来解决问题,另一方面是借此机会深入学习Spring AOP相关的内容。例如,以下需求不用AOP肯定也能解决,至于是否牵强附会,仁者见仁智者见智。
1.对部分函数的调用进行日志记录,用于观察特定问题在运行过程中的函数调用
- [Gson六]Gson类型适配器(TypeAdapter)
bit1129
Adapter
TypeAdapter的使用动机
Gson在序列化和反序列化时,默认情况下,是按照POJO类的字段属性名和JSON串键进行一一映射匹配,然后把JSON串的键对应的值转换成POJO相同字段对应的值,反之亦然,在这个过程中有一个JSON串Key对应的Value和对象之间如何转换(序列化/反序列化)的问题。
以Date为例,在序列化和反序列化时,Gson默认使用java.
- 【spark八十七】给定Driver Program, 如何判断哪些代码在Driver运行,哪些代码在Worker上执行
bit1129
driver
Driver Program是用户编写的提交给Spark集群执行的application,它包含两部分
作为驱动: Driver与Master、Worker协作完成application进程的启动、DAG划分、计算任务封装、计算任务分发到各个计算节点(Worker)、计算资源的分配等。
计算逻辑本身,当计算任务在Worker执行时,执行计算逻辑完成application的计算任务
- nginx 经验总结
ronin47
nginx 总结
深感nginx的强大,只学了皮毛,把学下的记录。
获取Header 信息,一般是以$http_XX(XX是小写)
获取body,通过接口,再展开,根据K取V
获取uri,以$arg_XX
&n
- 轩辕互动-1.求三个整数中第二大的数2.整型数组的平衡点
bylijinnan
数组
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ExoWeb {
public static void main(String[] args) {
ExoWeb ew=new ExoWeb();
System.out.pri
- Netty源码学习-Java-NIO-Reactor
bylijinnan
java多线程netty
Netty里面采用了NIO-based Reactor Pattern
了解这个模式对学习Netty非常有帮助
参考以下两篇文章:
http://jeewanthad.blogspot.com/2013/02/reactor-pattern-explained-part-1.html
http://gee.cs.oswego.edu/dl/cpjslides/nio.pdf
- AOP通俗理解
cngolon
springAOP
1.我所知道的aop 初看aop,上来就是一大堆术语,而且还有个拉风的名字,面向切面编程,都说是OOP的一种有益补充等等。一下子让你不知所措,心想着:怪不得很多人都和 我说aop多难多难。当我看进去以后,我才发现:它就是一些java基础上的朴实无华的应用,包括ioc,包括许许多多这样的名词,都是万变不离其宗而 已。 2.为什么用aop&nb
- cursor variable 实例
ctrain
variable
create or replace procedure proc_test01
as
type emp_row is record(
empno emp.empno%type,
ename emp.ename%type,
job emp.job%type,
mgr emp.mgr%type,
hiberdate emp.hiredate%type,
sal emp.sal%t
- shell报bash: service: command not found解决方法
daizj
linuxshellservicejps
今天在执行一个脚本时,本来是想在脚本中启动hdfs和hive等程序,可以在执行到service hive-server start等启动服务的命令时会报错,最终解决方法记录一下:
脚本报错如下:
./olap_quick_intall.sh: line 57: service: command not found
./olap_quick_intall.sh: line 59
- 40个迹象表明你还是PHP菜鸟
dcj3sjt126com
设计模式PHP正则表达式oop
你是PHP菜鸟,如果你:1. 不会利用如phpDoc 这样的工具来恰当地注释你的代码2. 对优秀的集成开发环境如Zend Studio 或Eclipse PDT 视而不见3. 从未用过任何形式的版本控制系统,如Subclipse4. 不采用某种编码与命名标准 ,以及通用约定,不能在项目开发周期里贯彻落实5. 不使用统一开发方式6. 不转换(或)也不验证某些输入或SQL查询串(译注:参考PHP相关函
- Android逐帧动画的实现
dcj3sjt126com
android
一、代码实现:
private ImageView iv;
private AnimationDrawable ad;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout
- java远程调用linux的命令或者脚本
eksliang
linuxganymed-ssh2
转载请出自出处:
http://eksliang.iteye.com/blog/2105862
Java通过SSH2协议执行远程Shell脚本(ganymed-ssh2-build210.jar)
使用步骤如下:
1.导包
官网下载:
http://www.ganymed.ethz.ch/ssh2/
ma
- adb端口被占用问题
gqdy365
adb
最近重新安装的电脑,配置了新环境,老是出现:
adb server is out of date. killing...
ADB server didn't ACK
* failed to start daemon *
百度了一下,说是端口被占用,我开个eclipse,然后打开cmd,就提示这个,很烦人。
一个比较彻底的解决办法就是修改
- ASP.NET使用FileUpload上传文件
hvt
.netC#hovertreeasp.netwebform
前台代码:
<asp:FileUpload ID="fuKeleyi" runat="server" />
<asp:Button ID="BtnUp" runat="server" onclick="BtnUp_Click" Text="上 传" />
- 代码之谜(四)- 浮点数(从惊讶到思考)
justjavac
浮点数精度代码之谜IEEE
在『代码之谜』系列的前几篇文章中,很多次出现了浮点数。 浮点数在很多编程语言中被称为简单数据类型,其实,浮点数比起那些复杂数据类型(比如字符串)来说, 一点都不简单。
单单是说明 IEEE浮点数 就可以写一本书了,我将用几篇博文来简单的说说我所理解的浮点数,算是抛砖引玉吧。 一次面试
记得多年前我招聘 Java 程序员时的一次关于浮点数、二分法、编码的面试, 多年以后,他已经称为了一名很出色的
- 数据结构随记_1
lx.asymmetric
数据结构笔记
第一章
1.数据结构包括数据的
逻辑结构、数据的物理/存储结构和数据的逻辑关系这三个方面的内容。 2.数据的存储结构可用四种基本的存储方法表示,它们分别是
顺序存储、链式存储 、索引存储 和 散列存储。 3.数据运算最常用的有五种,分别是
查找/检索、排序、插入、删除、修改。 4.算法主要有以下五个特性:
输入、输出、可行性、确定性和有穷性。 5.算法分析的
- linux的会话和进程组
网络接口
linux
会话: 一个或多个进程组。起于用户登录,终止于用户退出。此期间所有进程都属于这个会话期。会话首进程:调用setsid创建会话的进程1.规定组长进程不能调用setsid,因为调用setsid后,调用进程会成为新的进程组的组长进程.如何保证? 先调用fork,然后终止父进程,此时由于子进程的进程组ID为父进程的进程组ID,而子进程的ID是重新分配的,所以保证子进程不会是进程组长,从而子进程可以调用se
- 二维数组 元素的连续求解
1140566087
二维数组ACM
import java.util.HashMap;
public class Title {
public static void main(String[] args){
f();
}
// 二位数组的应用
//12、二维数组中,哪一行或哪一列的连续存放的0的个数最多,是几个0。注意,是“连续”。
public static void f(){
- 也谈什么时候Java比C++快
windshome
javaC++
刚打开iteye就看到这个标题“Java什么时候比C++快”,觉得很好笑。
你要比,就比同等水平的基础上的相比,笨蛋写得C代码和C++代码,去和高手写的Java代码比效率,有什么意义呢?
我是写密码算法的,深刻知道算法C和C++实现和Java实现之间的效率差,甚至也比对过C代码和汇编代码的效率差,计算机是个死的东西,再怎么优化,Java也就是和C