现在位置: 首页 > bani发表的所有文章
  • 08月
  • 01日
综合 ⁄ 共 419字 评论关闭
http://acm.hdu.edu.cn/showproblem.php?pid=1048 //字符串 #include <iostream> #include <cstring> using namespace std; int main() { char oper[11]; char str[255]; int i, j; while (scanf("%s%*c", oper)) { if (strcmp(oper,"START") == 0) { gets(str); if (strcmp(str,"END") == 0) continue; else { for (i = 0; i <(int) strlen(str); i++) { if (isalpha(str[i])) { j = str[i] - 'A'; str[i] = ((j >= 5) ? 'A'+j-5 : 'A'+26+j-5); ......
阅读全文
  • 05月
  • 14日
综合 ⁄ 共 6813字 评论关闭
* Copyright 2002-2012 the original author or authors. package org.springframework.web.servlet; import java.util.Map; import org.springframework.ui.ModelMap; import org.springframework.util.CollectionUtils; /** * Holder for both Model and View in the web MVC framework. * Note that these are entirely distinct. This class merely holds * both to make it possible for a controller to return both model * and view in a single return value. * * <p>Represents a model and view retur......
阅读全文
  • 04月
  • 17日
综合 ⁄ 共 335字 评论关闭
一开始想DP一步步迭代更新,求出跳到最后一个的最小步数,但是时间复杂度O(nk),会超时。 再一想,发现该题只需要返回能否到达最后一个,不需要最小步数,所以迭代时候只需要保留当前能够走到的最远距离tmpMax,时间复杂度降到O(n)。 class Solution { public: const int MAXVALUE = 1 << 30; bool canJump(int A[], int n) { int tmpMax = 0; if (n == 1) return true; for (int i = 0; i < n - 1; i++) { if (i > tmpMax)return false; if (tmpMax < i + A[i]) tmpMax = i + A[i]; ......
阅读全文
  • 01月
  • 04日
综合 ⁄ 共 1291字 评论关闭
from:http://blog.csdn.net/mjx20045912/article/details/6928934 今天看到关于求两个字符串的最长公共子串的算法,写出来和大家分享一下。 算法:求两个字符串的最长公共子串 原理: 1。 将连个字符串分别以行列组成一个矩阵。 2。若该矩阵的节点对应的字符相同,则该节点值为1。 3。当前字符相同节点的值 = 左上角(d[i-1, j-1])的值 +1,这样当前节点的值就是最大公用子串的长。        (s2)  b  c    d  e (s1) a             0  0    0   0 b             1   0   0   0 c             0    2   0  0 d          ......
阅读全文
  • 12月
  • 18日
算法 ⁄ 共 1760字 评论关闭
http://www.spoj.com/problems/PROFIT/ 最大权闭合子图:点权之和最大的闭合图。 建图:每一条有向边变为容量为inf,源S到正权点v(wv>0)的边容量wv,负权点v(wv<0)到汇T的边容量−wv,零权点v(wv=0)不与源和汇相连。然后求最小割(SUM-最大流)即为答案。 /* * Author: yew1eb * Created Time: 2014年10月31日 星期五 15时39分22秒 * File Name: spoj1476 maximum profit.cpp */ #include <ctime> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include ......
阅读全文
  • 10月
  • 15日
综合 ⁄ 共 443字 评论关闭
04/05/09 星期日 晴   今天终于拿到了化验结果, 详细如下: 1 乙肝表面抗原(HBsAg) 阴性(-) 2 乙肝表面抗体(HBsAb) 阳性(-) 3 乙肝e抗原(HBeAg)     阴性(-) 4 乙肝e抗原(HBeAb)     阴性(-) 5 乙肝抗心抗体(HBcAg) 阴性(-) 6 丙肝抗体检测(HCN)    阴性(-) 背景色被加深的那一栏说明我还有抗体, 不用打疫苗了哦, 同时了, 也让某人的“阴谋诡计”没有得逞:)))) 下午陪S和她同学一起PIZZA了, 点菜时我还担心会吃不饱的, 吃了才明白, 一小块PIZZA分量和我在食堂里的一碗饭差不多, 吃完第二块就很......
阅读全文
  • 07月
  • 29日
综合 ⁄ 共 2924字 评论关闭
使用 HttpBrowserCapabilities 类轻松实现。 HttpBrowserCapabilities 的名称空间是: System.Web 该名称空间默认是导入的。 示例 <%@ Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server">    void Page_Load(object sender, EventArgs e)    {        HttpBrowserCapabilities bc = Request.Browser;                list.Text = "";        list.Text += "操作系统:" + bc.Platform +......
阅读全文
  • 06月
  • 09日
综合 ⁄ 共 231字 评论关闭
原文:jfware开始篇: hibernate4.1.9 + spring 3.2.2整合示例(CRUD) 源代码下载地址:http://www.zuidaima.com/share/1550463702518784.htm 最近看了这篇文章,决定多动动手,顺便复习一下。 本人技术不牛,还请牛友多多指教。 完整的jar: 链接:http://pan.baidu.com/share/link?shareid=4248170828&uk=402880896 密码:ehqc 源码截图
阅读全文
  • 05月
  • 12日
综合 ⁄ 共 3328字 评论关闭
在cocoa application的应用中,我们有时会使用Core Foundation(CF),我们经常会在Objective-C和CF之间进行转化。系统使用arc的状态下,编译器不能自动管理CF的内存,这时候你必须使用CFRetain和CFRelease来进行CF的内存的管理。   具体的CF内存管理规则见: Memory Management Programming Guide for Core Foundation   在OC和FC之间进行转化的时候,主要是对象的归属问题。共有两种方式:   1、使用宏,可以标识归属者从OC到CF,还是从CF到OC。   NS_INLINE CFTypeRef CFBridgingRetain(id X) {      return (__bridge......
阅读全文
  • 05月
  • 06日
综合 ⁄ 共 7025字 评论关闭
1、节点定义: public class Node<T>    {        private T data;//数据域        private Node<T> next;//引用域        /// <summary>        /// 构造器,数据值为输入数据值        /// </summary>        /// <param name="val"></param>        public Node(T val)        {            data = val;            next = null;        }        /// <summary>        /// 构造器,数据值为系统默认值        /// </summary>        public Node()        {            data ......
阅读全文
  • 05月
  • 06日
综合 ⁄ 共 52字 评论关闭
setInterval 定时执行一次(循环执行) 放外部 setTimeOut 延迟执行一次(只执行一次) 放内部
阅读全文
  • 04月
  • 25日
综合 ⁄ 共 649字 评论关闭
first: php中常用的路径 当前文件路径:D:\phpweb\php_example\include_path.php 1.dirname(__FILE__); //输出D:\phpweb\php_example 2.$_SERVER['SCRIPT_FILENAME']; //输出D:/phpweb/php_example/include_path.php second: php中的set_include_path 在php中,include文件时,当包含路径不为相对也不为绝对时(如:include("example.php")),会先查找include_path所设置的目录,然后再在当前目录查找,这也是为什么很多资料上提到include("./example.php")比include("example.php")效率高的原因。 方法: 1.ini_set("include_pat......
阅读全文