KMP算法的综合练习DP很久没写搞了半天才明白。本题结合Next[]的意义以及动态规划考察对KMP算法的掌握。Problem DescriptionIt is well known that AekdyCoin is good at string problems as well as number...
分类:
其他好文 时间:
2015-02-23 16:39:09
阅读次数:
135
/**
* 蟠桃记
* 每天吃掉桃子总数一半多一个
*/
import java.util.*;
public class acm2013 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while(in.hasNextInt()){
int d...
分类:
其他好文 时间:
2015-02-23 15:33:42
阅读次数:
170
C# IO流的操作非常重要,我们读写文件都会使用到这个技术,这里先演示一个文件内容复制的例子,简要说明C#中的IO操作。namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
//将文件内容读到流中
...
Write a function to find the longest common prefix string amongst an array of strings.思路分析:这题很简单,基本就是以第一个字符串为标准,同时扫描后面的字符串对应index 字符是否相同,找到最大的相同前缀。但是实现的时候还是要注意一些corner case,比如输入数组为空或者只包含一个字符串的情况。AC Co...
分类:
其他好文 时间:
2015-02-23 12:02:19
阅读次数:
145
还没开始系统性的学习Ruby,最近在看metasploit框架的exploit会涉及到Ruby脚本,也就硬着头皮一遍查阅资料一遍做些笔记吧。 Ruby字符串中存在chop和chomp的内置函数。我在http://www.w3cschool.cc/ruby/ruby-string.html中得到的关于...
分类:
其他好文 时间:
2015-02-23 11:57:50
阅读次数:
175
Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "25525511135",return ["255.255.11.135", "255.255.111.35"]. (Order does not m...
分类:
其他好文 时间:
2015-02-23 10:55:22
阅读次数:
176
首先是定义栈的基本结构,由于用数组实现 private String[] stack; private int TOP = 0;然后是构造方法 StackOfStrings(int capacity) { stack = new String[capacity]; }然后是push,注意,TOP永....
分类:
编程语言 时间:
2015-02-23 10:46:31
阅读次数:
169
给定公历日期,计算返回该日期对应的十二星座。
public static String getXingZuoName(int month, int day);
注意:参数month和day均为公历月、日。
返回的中文星座名如:处女座。
import java.util.Map;
import java.util.HashMap;
import java.util.ArrayList...
分类:
编程语言 时间:
2015-02-23 09:43:30
阅读次数:
232
Problem Description
There are two strings A and B with equal length. Both strings are made up of lower case letters. Now you have a powerful string painter. With the help of the painter, you can chan...
分类:
其他好文 时间:
2015-02-23 09:40:33
阅读次数:
167
publicclassDBCPDemo{publicstaticvoidmain(String[]args){Stringurl="jdbc:oracle:thin:@localhost:1521:orcl";//声明连接字符串Stringdriver="oracle.jdbc.driver.OracleDriver";//声明驱动类StringuserName="scott";Stringpwd="tiger";BasicDataSourcebds=newBasicDataSourc..
分类:
数据库 时间:
2015-02-23 00:17:20
阅读次数:
280