基本的数位dp,需要记录前面除以13的余数。#include#includeusingnamespacestd;#defineD(x)xconstintMAX_DIGIT=35;intn,m;intf[MAX_DIGIT];intmemoize[MAX_DIGIT][2][2][2][13];voidto_digits(inta){for(inti=0;i
数位DP入门之hdu 3652 B-number
weixin_30655569
hdu3652B-numberProblemDescriptionAwqb-number,orB-numberforshort,isanon-negativeintegerwhosedecimalformcontainsthesub-string“13”andcanbedividedby13.Forexample,130and2613arewqb-numbers,but143and2639aren
hdu3652(数位dp)
weixin_30532973
java
B-numberTimeLimit:2000/1000MS(Java/Others)MemoryLimit:32768/32768K(Java/Others)TotalSubmission(s):4184AcceptedSubmission(s):2397ProblemDescriptionAwqb-number,orB-numberforshort,isanon-negativeintegerw
hdu3652 B-number (含有13并且是13 的倍数)数位dp
weixin_30343157
php
题意:http://acm.hdu.edu.cn/showproblem.php?pid=3652问从0到n多少个数字是13倍数并且含有子串13记一下当前的余数,是否已经是13倍数和上一位的数字大小#include#include#include#include#include#include#include#include#includeusingnamespacestd;#defineINF0
【数位DP】G - B-number HDU - 3652
ummmmm
数位DP
B-numberTimeLimit:2000/1000MS(Java/Others)MemoryLimit:32768/32768K(Java/Others)TotalSubmission(s):8578AcceptedSubmission(s):5088ProblemDescriptionAwqb-number,orB-numberforshort,isanon-negativeintegerw
HDU——B-number(数位DP)
fa茶
#动态规划
题目大意:要找出1到n之间有多少个数含13,并且能被13整除记忆化搜索:dp[pos][pre][mod][statu],pos位数,pre前一位,mod余数,statu状态有2个状态:含13,不含13#include#include#include#include#include#include#include#include#include#include#include#include#in
hdu3652(数位DP)
slmady
acm之DP
做了n久才搞定,感觉自己的数位DP学的太不扎实了题意:求1--n中能有13这个数字且能被13整除的数的数目解释看代码:#include#include#include#include#include#include#include#include#include#include#include#include#defineinf0x7fffffff#defineeps1e-9#definepiac
HDU 3652 B-number
有理想的咸鱼丶
ProblemDescriptionAwqb-number,orB-numberforshort,isanon-negativeintegerwhosedecimalformcontainsthesub-string"13"andcanbedividedby13.Forexample,130and2613arewqb-numbers,but143and2639arenot.Yourtaskisto
hdu3652
查尔斯欢
动态规划
数位dp分析题目需求,需要求数字中含有13且能被13整除的数字,是否含有13很容易判断,数位dp时记录一下是否含有13即可,若含有,则不论首位,如不含,则首位为1且次位为3的才满足题意,但是确定能否被13整除就优点麻烦了,按照一般数位dp的方法,由于从高位到低位进行统计,并不知道某个数能否被13整除,无法确定该数字是否满足题意。再分析,对任意一个数字对13取余均只有13中情况,那么在统计时,记录高
hdu3652 B-number
相知无悔
hdudp
B-numberTimeLimit:2000/1000MS(Java/Others)MemoryLimit:32768/32768K(Java/Others)TotalSubmission(s):1658AcceptedSubmission(s):906ProblemDescriptionAwqb-number,orB-numberforshort,isanon-negativeintegerwh
hdu3652 数位dp
王的守护者
ACM_DP
表示数位dp方面基本是一窍不通,特此选了几个基础题练练,先贴代码,思路有时间再补。#include#include#includeusingnamespacestd;intdp[15][11][13][2];intpow(inta,intb){intret=1;while(b){ret*=a;b--;}returnret;}voidinit(){memset(dp,0,sizeof(dp));fo
HDU3652,B-number(数位DP)
shamansi99
数位DP数位DP
用数位DP。状态:dp[i,j,k,state]表示枚举到第i位时,前一位数字为j,前面各个数字组成的数mod13=k,当前是否包含“13”串(state=0否state=1是),符合条件的数字的总个数边界:return(state&&!k)?1:0代码如下:#include#include#include#include#include#include#include#include#inclu
HDU3652(数位dp)
Karmen Yang
DP
HDU3652题意:求1~n里有多少个能被13整除且数字里面包含十三的数的个数#include#include#include#includeusingnamespacestd;inta[15],n,ans;intdp[15][15][3];//dp[i][j][k]表示i位的数字,%13余j,k=1表示最后一位是1,k=0表示最后一位不是1,k=2表示前面出现过13intdfs(intpos,i
HDU3652(数位dp)
撒旦即可
#动态规划
解题思路:和HDU2089相对,数位dp目前我看到两种写法。一种是初始化好dp,后面直接用,这种适用于范围比较小的时候。还有一种就是在做道题,直接带入dfs,一个询问一次dp.代码中的lim代表是不是可以0——9随便取,即限制他不能大于输入的n.总体然说感觉就是个记忆化搜索。dp[pos][sts][mo],中pos代表第pos位数,sts代表在pos-1前的状态(0表示前面没有13出现,且pos
B-number HDU - 3652
__Lyx
数位dp
题目链接十分简单,与不要62几乎相同,关键是对驱魔(取模)的运算re数组于是就显得十分重要。#include#includeusingnamespacestd;intn;intb[21];intre[21];intdp[21][2][2][14];intdfs(intpos,intpreok,intpre1,intpre13,intnum){if(pos==-1){return(!num)&&pr
hdu 3652 B-number (数位DP)
Just_JK
数位DP
B-numberTimeLimit:2000/1000MS(Java/Others)MemoryLimit:32768/32768K(Java/Others)TotalSubmission(s):7194AcceptedSubmission(s):4211ProblemDescriptionAwqb-number,orB-numberforshort,isanon-negativeintegerw
HDU3652-B-number
Jack-Oran
=====dp=====#数位dpHDU
dp系列中还有一类叫做数位dp,那么今天结合这道HDU3652来看一看数位dp到底是什么。B-numberAwqb-number,orB-numberforshort,isanon-negativeintegerwhosedecimalformcontainsthesub-string"13"andcanbedividedby13.Forexample,130and2613arewqb-numbe
HDU 3652 B-number (简单数位DP)
Neutralzz
DP
dp[i][s][k]k为模13的余数。s=0,不存在;s=1,不存在,上一位为1;s=2,存在。我的代码:#include#include#include#includeusingnamespacestd;intn,dp[12][15][3];intbit[12],top;intget_newk(intk,intd){if(k==0){if(d==1)return1;elsereturn0;}i
hdu 3652 B-number 数位dp
01的世界
————动态规划————
题目:点击打开链接题意:求小于n,是13的倍数且含有'13'的数的个数。n《1e9分析:看了别人的才写出来,点击打开链接,因为要两个要求,不含13且不是13的倍数,这样的话,可是可以用三维数组表示状态f[i][j][k],铁打不变的是i表示数位,然后增加上用j表示余数,k表示是否含有13。然后dfs,从高位开始以此判断每一位的状态,#include#include#include#includeu
HDU3652:B-number(数位DP)
键盘上的舞者
DP
ProblemDescriptionAwqb-number,orB-numberforshort,isanon-negativeintegerwhosedecimalformcontainsthesub-string"13"andcanbedividedby13.Forexample,130and2613arewqb-numbers,but143and2639arenot.Yourtaskisto
HDU 3652 B-number (数位DP)
LzyRapX
HDUOJACM_数位DP
B-numberTimeLimit:2000/1000MS(Java/Others)MemoryLimit:32768/32768K(Java/Others)TotalSubmission(s):4413AcceptedSubmission(s):2540ProblemDescriptionAwqb-number,orB-numberforshort,isanon-negativeintegerw
HDU-3652 B-number(数位DP+记忆化搜索)
信仰..
DP
G-B-numberTimeLimit:1000MSMemoryLimit:32768KB64bitIOFormat:%I64d&%I64uSubmitStatusPracticeHDU3652DescriptionAwqb-number,orB-numberforshort,isanon-negativeintegerwhosedecimalformcontainsthesub-string
【题解】B-number
ezoixx130
C++题解数位dp
B-numberDescription一个wqb号或简称B号是一个非负整数,其十进制形式包含子串“13”,可以除以13.例如,130和2613是wqb数,而143和2639不是。您的任务是为给定的整数n计算从1到n的wqb数。(原文:Awqb-number,orB-numberforshort,isanon-negativeintegerwhosedecimalformcontainsthesub
HDU 3652 B-number
New-Spirit
**数位DP动态规划DP
B-numberTimeLimit:2000/1000MS(Java/Others)MemoryLimit:32768/32768K(Java/Others)TotalSubmission(s):2464AcceptedSubmission(s):1346ProblemDescriptionAwqb-number,orB-numberforshort,isanon-negativeintegerw
安装数据库首次应用
Array_06
javaoraclesql
可是为什么再一次失败之后就变成直接跳过那个要求
enter full pathname of java.exe的界面
这个java.exe是你的Oracle 11g安装目录中例如:【F:\app\chen\product\11.2.0\dbhome_1\jdk\jre\bin】下的java.exe 。不是你的电脑安装的java jdk下的java.exe!
注意第一次,使用SQL D
Weblogic Server Console密码修改和遗忘解决方法
bijian1013
Welogic
在工作中一同事将Weblogic的console的密码忘记了,通过网上查询资料解决,实践整理了一下。
一.修改Console密码
打开weblogic控制台,安全领域 --> myrealm -->&n
IllegalStateException: Cannot forward a response that is already committed
Cwind
javaServlets
对于初学者来说,一个常见的误解是:当调用 forward() 或者 sendRedirect() 时控制流将会自动跳出原函数。标题所示错误通常是基于此误解而引起的。 示例代码:
protected void doPost() {
if (someCondition) {
sendRedirect();
}
forward(); // Thi
基于流的装饰设计模式
木zi_鸣
设计模式
当想要对已有类的对象进行功能增强时,可以定义一个类,将已有对象传入,基于已有的功能,并提供加强功能。
自定义的类成为装饰类
模仿BufferedReader,对Reader进行包装,体现装饰设计模式
装饰类通常会通过构造方法接受被装饰的对象,并基于被装饰的对象功能,提供更强的功能。
装饰模式比继承灵活,避免继承臃肿,降低了类与类之间的关系
装饰类因为增强已有对象,具备的功能该
Linux中的uniq命令
被触发
linux
Linux命令uniq的作用是过滤重复部分显示文件内容,这个命令读取输入文件,并比较相邻的行。在正常情 况下,第二个及以后更多个重复行将被删去,行比较是根据所用字符集的排序序列进行的。该命令加工后的结果写到输出文件中。输入文件和输出文件必须不同。如 果输入文件用“- ”表示,则从标准输入读取。
AD:
uniq [选项] 文件
说明:这个命令读取输入文件,并比较相邻的行。在正常情况下,第二个
正则表达式Pattern
肆无忌惮_
Pattern
正则表达式是符合一定规则的表达式,用来专门操作字符串,对字符创进行匹配,切割,替换,获取。
例如,我们需要对QQ号码格式进行检验
规则是长度6~12位 不能0开头 只能是数字,我们可以一位一位进行比较,利用parseLong进行判断,或者是用正则表达式来匹配[1-9][0-9]{4,14} 或者 [1-9]\d{4,14}
&nbs
Oracle高级查询之OVER (PARTITION BY ..)
知了ing
oraclesql
一、rank()/dense_rank() over(partition by ...order by ...)
现在客户有这样一个需求,查询每个部门工资最高的雇员的信息,相信有一定oracle应用知识的同学都能写出下面的SQL语句:
select e.ename, e.job, e.sal, e.deptno
from scott.emp e,
(se
Python调试
矮蛋蛋
pythonpdb
原文地址:
http://blog.csdn.net/xuyuefei1988/article/details/19399137
1、下面网上收罗的资料初学者应该够用了,但对比IBM的Python 代码调试技巧:
IBM:包括 pdb 模块、利用 PyDev 和 Eclipse 集成进行调试、PyCharm 以及 Debug 日志进行调试:
http://www.ibm.com/d
webservice传递自定义对象时函数为空,以及boolean不对应的问题
alleni123
webservice
今天在客户端调用方法
NodeStatus status=iservice.getNodeStatus().
结果NodeStatus的属性都是null。
进行debug之后,发现服务器端返回的确实是有值的对象。
后来发现原来是因为在客户端,NodeStatus的setter全部被我删除了。
本来是因为逻辑上不需要在客户端使用setter, 结果改了之后竟然不能获取带属性值的
java如何干掉指针,又如何巧妙的通过引用来操作指针————>说的就是java指针
百合不是茶
C语言的强大在于可以直接操作指针的地址,通过改变指针的地址指向来达到更改地址的目的,又是由于c语言的指针过于强大,初学者很难掌握, java的出现解决了c,c++中指针的问题 java将指针封装在底层,开发人员是不能够去操作指针的地址,但是可以通过引用来间接的操作:
定义一个指针p来指向a的地址(&是地址符号):
Eclipse打不开,提示“An error has occurred.See the log file ***/.log”
bijian1013
eclipse
打开eclipse工作目录的\.metadata\.log文件,发现如下错误:
!ENTRY org.eclipse.osgi 4 0 2012-09-10 09:28:57.139
!MESSAGE Application error
!STACK 1
java.lang.NoClassDefFoundError: org/eclipse/core/resources/IContai
spring aop实例annotation方法实现
bijian1013
javaspringAOPannotation
在spring aop实例中我们通过配置xml文件来实现AOP,这里学习使用annotation来实现,使用annotation其实就是指明具体的aspect,pointcut和advice。1.申明一个切面(用一个类来实现)在这个切面里,包括了advice和pointcut
AdviceMethods.jav
[Velocity一]Velocity语法基础入门
bit1129
velocity
用户和开发人员参考文档
http://velocity.apache.org/engine/releases/velocity-1.7/developer-guide.html
注释
1.行级注释##
2.多行注释#* *#
变量定义
使用$开头的字符串是变量定义,例如$var1, $var2,
赋值
使用#set为变量赋值,例
【Kafka十一】关于Kafka的副本管理
bit1129
kafka
1. 关于request.required.acks
request.required.acks控制者Producer写请求的什么时候可以确认写成功,默认是0,
0表示即不进行确认即返回。
1表示Leader写成功即返回,此时还没有进行写数据同步到其它Follower Partition中
-1表示根据指定的最少Partition确认后才返回,这个在
Th
lua统计nginx内部变量数据
ronin47
lua nginx 统计
server {
listen 80;
server_name photo.domain.com;
location /{set $str $uri;
content_by_lua '
local url = ngx.var.uri
local res = ngx.location.capture(
java-11.二叉树中节点的最大距离
bylijinnan
java
import java.util.ArrayList;
import java.util.List;
public class MaxLenInBinTree {
/*
a. 1
/ \
2 3
/ \ / \
4 5 6 7
max=4 pass "root"
Netty源码学习-ReadTimeoutHandler
bylijinnan
javanetty
ReadTimeoutHandler的实现思路:
开启一个定时任务,如果在指定时间内没有接收到消息,则抛出ReadTimeoutException
这个异常的捕获,在开发中,交给跟在ReadTimeoutHandler后面的ChannelHandler,例如
private final ChannelHandler timeoutHandler =
new ReadTim
jquery验证上传文件样式及大小(好用)
cngolon
文件上传jquery验证
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="jquery1.8/jquery-1.8.0.
浏览器兼容【转】
cuishikuan
css浏览器IE
浏览器兼容问题一:不同浏览器的标签默认的外补丁和内补丁不同
问题症状:随便写几个标签,不加样式控制的情况下,各自的margin 和padding差异较大。
碰到频率:100%
解决方案:CSS里 *{margin:0;padding:0;}
备注:这个是最常见的也是最易解决的一个浏览器兼容性问题,几乎所有的CSS文件开头都会用通配符*来设
Shell特殊变量:Shell $0, $#, $*, $@, $?, $$和命令行参数
daizj
shell$#$?特殊变量
前面已经讲到,变量名只能包含数字、字母和下划线,因为某些包含其他字符的变量有特殊含义,这样的变量被称为特殊变量。例如,$ 表示当前Shell进程的ID,即pid,看下面的代码:
$echo $$
运行结果
29949
特殊变量列表 变量 含义 $0 当前脚本的文件名 $n 传递给脚本或函数的参数。n 是一个数字,表示第几个参数。例如,第一个
程序设计KISS 原则-------KEEP IT SIMPLE, STUPID!
dcj3sjt126com
unix
翻到一本书,讲到编程一般原则是kiss:Keep It Simple, Stupid.对这个原则深有体会,其实不仅编程如此,而且系统架构也是如此。
KEEP IT SIMPLE, STUPID! 编写只做一件事情,并且要做好的程序;编写可以在一起工作的程序,编写处理文本流的程序,因为这是通用的接口。这就是UNIX哲学.所有的哲学真 正的浓缩为一个铁一样的定律,高明的工程师的神圣的“KISS 原
android Activity间List传值
dcj3sjt126com
Activity
第一个Activity:
import java.util.ArrayList;import java.util.HashMap;import java.util.List;import java.util.Map;import android.app.Activity;import android.content.Intent;import android.os.Bundle;import a
tomcat 设置java虚拟机内存
eksliang
tomcat 内存设置
转载请出自出处:http://eksliang.iteye.com/blog/2117772
http://eksliang.iteye.com/
常见的内存溢出有以下两种:
java.lang.OutOfMemoryError: PermGen space
java.lang.OutOfMemoryError: Java heap space
------------
Android 数据库事务处理
gqdy365
android
使用SQLiteDatabase的beginTransaction()方法可以开启一个事务,程序执行到endTransaction() 方法时会检查事务的标志是否为成功,如果程序执行到endTransaction()之前调用了setTransactionSuccessful() 方法设置事务的标志为成功则提交事务,如果没有调用setTransactionSuccessful() 方法则回滚事务。事
Java 打开浏览器
hw1287789687
打开网址open浏览器open browser打开url打开浏览器
使用java 语言如何打开浏览器呢?
我们先研究下在cmd窗口中,如何打开网址
使用IE 打开
D:\software\bin>cmd /c start iexplore http://hw1287789687.iteye.com/blog/2153709
使用火狐打开
D:\software\bin>cmd /c start firefox http://hw1287789
ReplaceGoogleCDN:将 Google CDN 替换为国内的 Chrome 插件
justjavac
chromeGooglegoogle apichrome插件
Chrome Web Store 安装地址: https://chrome.google.com/webstore/detail/replace-google-cdn/kpampjmfiopfpkkepbllemkibefkiice
由于众所周知的原因,只需替换一个域名就可以继续使用Google提供的前端公共库了。 同样,通过script标记引用这些资源,让网站访问速度瞬间提速吧
进程VS.线程
m635674608
线程
资料来源:
http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000/001397567993007df355a3394da48f0bf14960f0c78753f000 1、Apache最早就是采用多进程模式 2、IIS服务器默认采用多线程模式 3、多进程优缺点 优点:
多进程模式最大
Linux下安装MemCached
字符串
memcached
前提准备:1. MemCached目前最新版本为:1.4.22,可以从官网下载到。2. MemCached依赖libevent,因此在安装MemCached之前需要先安装libevent。2.1 运行下面命令,查看系统是否已安装libevent。[root@SecurityCheck ~]# rpm -qa|grep libevent libevent-headers-1.4.13-4.el6.n
java设计模式之--jdk动态代理(实现aop编程)
Supanccy2013
javaDAO设计模式AOP
与静态代理类对照的是动态代理类,动态代理类的字节码在程序运行时由Java反射机制动态生成,无需程序员手工编写它的源代码。动态代理类不仅简化了编程工作,而且提高了软件系统的可扩展性,因为Java 反射机制可以生成任意类型的动态代理类。java.lang.reflect 包中的Proxy类和InvocationHandler 接口提供了生成动态代理类的能力。
&
Spring 4.2新特性-对java8默认方法(default method)定义Bean的支持
wiselyman
spring 4
2.1 默认方法(default method)
java8引入了一个default medthod;
用来扩展已有的接口,在对已有接口的使用不产生任何影响的情况下,添加扩展
使用default关键字
Spring 4.2支持加载在默认方法里声明的bean
2.2
将要被声明成bean的类
public class DemoService {