Assume s is a string of lower case characters.
Write a program that prints the longest substring of s in which the letters occur in alphabetical order. For example, if s = 'azcbobobegghakl', then y...
分类:
编程语言 时间:
2015-03-03 22:17:49
阅读次数:
805
题意:m个水果,n个价格。每种水果只有一个价格。问如果给每种水果分配价格,使得买的m个水果总价格最小、最大。输出最小值和最大值。思路:贪心。代码:bool cmp(int a,int b){ return a>b;}string name;map mp;int price[200],fruit...
分类:
其他好文 时间:
2015-03-03 22:05:22
阅读次数:
259
当存储到mongodb中的是string类型的时间,小tips:1. 那么在对此域按照时间聚类(每周,每月)时就不能直接使用mongodb的time关键字了,因为mongodb有自己的时间类型,且目前它只认可自己的时间类型。2. 假如对于时间进行简单的聚类,比如按照年,月,日,时,分,秒来聚类,我们...
分类:
数据库 时间:
2015-03-03 22:00:39
阅读次数:
239
public class Varargs{ public static void main(String[] args) { test(3,"java","C++","PHP"); } public static void test(int num,String... books) { Sys...
分类:
编程语言 时间:
2015-03-03 21:52:27
阅读次数:
136
如果要打印对象信息,在OC 中用到 description方法,在 swift 中需要遵守协议 DebugPrintableextension : DebugPrintable {
override var debugDescription: String {
return "description"
}
}...
分类:
编程语言 时间:
2015-03-03 20:43:47
阅读次数:
573
Swift 的String类型与 Foundation NSString类进行了无缝桥接。在日常开发中,绝大多数应该用 StringString 与 NSString 还有以下区别
String类型是值类型(不再是对象类型),字符串在进行常量、变量赋值操作或在函数/方法中传递时,会进行值拷贝。 任何情况下,都会对已有字符串值创建新副本,并对该新副本进行传递或赋值操作。
String 可以支持字符遍历...
分类:
其他好文 时间:
2015-03-03 20:43:34
阅读次数:
154
最长回文子串动态规划的方法的参考Palindrome Partitioning (回文子串题)代码:class Solution {public: string longestPalindrome(string s) { int n=s.size(); int dp...
分类:
其他好文 时间:
2015-03-03 20:39:26
阅读次数:
105
下面是代码: static void Main(string[] args) { string[] arr = new string[] { "AAA", "BBBB", "CCCC", "DDDD", "EEEEEE", "ffffff", "ggggggg",...
分类:
编程语言 时间:
2015-03-03 20:13:00
阅读次数:
173
post方式string stratTime="";string end=""://要拼接的参数string postURL = "http://www.baidu.com?startTime=" + start + "&endTime=" + end;Encoding dataEncode=...
分类:
Web程序 时间:
2015-03-03 20:11:36
阅读次数:
127
resourceproc_open(string$cmd,array$descriptorspec,array&$pipes[,string$cwd[,array$env[,array$other_options]]])windows环境下,如果cmd为完整路径,使用“”包括起来,且后面的参数也包含有“”括起来的参数,则会显示解析命令失败。如$cmd="C:\ProgramFiles\Scutech..
分类:
其他好文 时间:
2015-03-03 19:04:25
阅读次数:
214