现在位置: 首页 > alap发表的所有文章
  • 11月
  • 06日
综合 ⁄ 共 853字 评论关闭
 最长上升子序列。 怎么做呢? 不知道。 书上说用dp。 这样做的, dp[i]:长度为i的递增子序列,末尾元素最小的值。 也就是说对于一个数列a, 可以得到如下状态转移方程: dp[i]=a[j]>dp[i-1]?min(a[j],dp[i]):dp[i]. 这样的话容易得到如下代码: #include<iostream> #include<cstring> #include<algorithm> using namespace std; int main() { int inf,i,j,dp[1010],arr[1010],num; scanf("%d",&num); for(i=0;i<num;i++) scanf("%d",&arr[i]); memset(dp,127,sizeof(dp)); inf=dp[0];......
阅读全文
  • 08月
  • 20日
综合 ⁄ 共 548字 评论关闭
题目链接:Codeforces 467 George and Job 题目大意:给定一个长度为n的序列,从序列中选出k个不重叠且连续的m个数,要求和最大。 解题思路:dp[i][j]表示到第i个位置选了j个子序列。 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; typedef long long ll; const int maxn = 5005; int N, M, K; ll arr[maxn], sum[maxn]; ll dp[maxn][maxn]; ll solve () { ll ret = 0; for (int i = M; i <= N; i++) { ll tmp = sum[i] - sum[i-M]; for......
阅读全文
  • 12月
  • 20日
综合 ⁄ 共 537字 评论关闭
牛顿迭代 详细介绍见维基百科 http://zh.wikipedia.org/wiki/牛顿法   举一个栗子 找平方根 给一个数a,求其平方根。   设其平方根为x 则有 x^2 - a = 0,设函数f(x) = x^2 - a, 取x0的初值尽量靠近a的平方根(因为初值的选择影响迭代的次数) 根据 f(x0)  = (x0 - x).f’(x0) --->  x = x0 -  f(x0)/f’(x0)   ① --->  x0 = x                        ② 重复①、②直到abs(x-x0)<=eps,达到精度要求即可。 代码: a = input(); x0 = Init_Value; While( fabs(x-x0)>eps){        x0 = x;        x = x0 - f(x0)/f’(x0);......
阅读全文
  • 08月
  • 28日
综合 ⁄ 共 1289字 评论关闭
一.反编译Apk得到Java源代码    工具下载:需用到dex2jar和JD-GUI这2个工具 dex2jar下载地址:http://laichao.googlecode.com/files/dex2jar-0.0.7-SNAPSHOT.zipJD-GUI下载地址:  windows版JD-GUI:http://laichao.googlecode.com/files/jdgui.zip  Linux版JD-GUI:http://laichao.googlecode.com/files/jd-gui-0.3.2.linux.i686.tar.gz 步骤: 1.首先找到Android软件安装包中的classes.dex把.apk文件改名为.zip,然后解压缩,得到其中的classes.dex文件,它就是java文件编译再通过dx工具打包成的,所以现在我们就用上述提到的2个工......
阅读全文
下了最新的版本struts2.2.3.1,在使用的过程中总是报错:A web application created a ThreadLocal with key of type , 尽管出现了这个错误,但是并不妨碍程序正常运行, 虽然程序虽然能正常运行,但是看的这个错误很是别扭,所以网上搜了一下看看,也就有了下面这篇文章 struts2关于A web application created a ThreadLocal with key of type 异常解决办法    created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@12c74b9]) ......
阅读全文
  • 05月
  • 07日
综合 ⁄ 共 79字 评论关闭
$.parseJSON()只支持标准的JSON,不标准的还是用eval("("+data+")")吧。 什么 是标准的呢? key和value都带引号的就是标准的。
阅读全文
  • 05月
  • 03日
综合 ⁄ 共 866字 评论关闭
class Text1 { //选择排序:从小到大 public static void main(String[] args) { int[]arr=new int[]{12,9,56,45,10}; for (int c=0;c<arr.length;c++ )//控制从角标o到数组.length-1的比较次数 { for (int b=c+1;b<arr.length;b++ )//从上for中得到角标(c)与该角标与之比较的相应角标(c+1循环)的大小比较 { if(arr[c]>arr[b]) { arr[c]=arr[b];//这里思路错误,最终得到每次比较的最小值而不是整体数组的最小值 } } System.out.print(arr[c]);//第一次......
阅读全文
  • 04月
  • 18日
综合 ⁄ 共 1420字 评论关闭
昨天,在本机(win7-x64)上安装了一个WAMP (windows apache2.4 mysql php5.5)环境,步骤如下: 1、分别下载 apache (http://www.apachelounge.com/download/win64/)mysql(http://www.mysql.com/downloads/mysql/) php(http://windows.php.net/download/) 注意: Apache2.4.4需要VC10库支持,Microsoft Visual C++ 2010 SP1 Redistributable Package (x64) PHP5.5.0beta2需要VC11库支持,Visual C++ Redistributable for Visual Studio 2012 Update 1 2、安装Apache(将zip 包解压到D盘根目录下的Apache24下) I )打......
阅读全文
  • 04月
  • 04日
综合 ⁄ 共 8613字 评论关闭
 Android 系统APN配置详解        这些天一直在调系统原生的Settings.apk里面APN配置的问题,在设置里面手动增加了APN配置选项,但是在界面上还是看不到。所以跟了下代码,原以为就是简单的页面显示的问题,这一跟不要紧,一下就快追到HAL层去了(NND).         首先看Settings.apk的源码,位于packages/apps/Settings/src/com/android/settings/目录下:首先找到ApnSettings类,继承于PreferenceActivity,并实现了Preference.OnPreferenceChangeListener接口。PreferencesActivity是Android中专门用来实现程序设置界面及参数存储......
阅读全文
  • 01月
  • 14日
综合 ⁄ 共 1678字 评论关闭
Hat’s Words http://acm.hdu.edu.cn/showproblem.php?pid=1247 Problem Description A hat’s word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary. You are to find all the hat’s words in a dictionary.   Input Standard input consists of a number of lowercase words, one per line, in alphabetical order. There will be no more than 50,000 words. Only one case.   Output Your output should contain all the hat’s words, one per line, in alph......
阅读全文
  • 11月
  • 19日
综合 ⁄ 共 3387字 评论关闭
在网页设计中,有时会希望同一个自定义控件会有不同的样式出现在网页上,下面举个小例子,看看这种效果是怎么实现的吧! 1、首先添加一个自定义控件TextBox.ascx: <%...@ Control Language="C#" AutoEventWireup="true" CodeFile="TextBox.ascx.cs" Inherits="WebUserControl" %><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> 2、设置控件的不同样式: using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using Sys......
阅读全文
  • 11月
  • 18日
综合 ⁄ 共 2109字 评论关闭
今日谈随着技术的成熟,越来越多的主板和硬盘都开始支持SATA(串行ATA),SATA接口逐渐有取代传统的PATA(并行ATA)的趋势。  那么SATA和PATA在传输模式上有何区别,SATA相对PATA又有何优势呢?这就正是本文需要讨论的话题。何谓并行ATA  ATA其实是IDE设备的接口标准,大部分硬盘、光驱、软驱等等都使用的是ATA接口。譬如现在绝大部分的朋友用的都是并行ATA接口的硬盘,应该对它80针排线的接口是再熟悉不过了吧?平常我们说到硬盘接口,就不得不提到什么Ultra-ATA/100、Ultra-ATA/133,这表示什么呢?这告诉我们该硬盘接口的最大......
阅读全文