码迷,mamicode.com
首页 >  
搜索关键字:longest substring wi    ( 8067个结果
POJ 1631 Bridging signals & 2533 Longest Ordered Subsequence
两个都是最长上升子序列,所以就放一起了1631 因为长度为40000,所以要用O(nlogn)的算法,其实就是另用一个数组c来存储当前最长子序列每一位的最小值,然后二分查找当前值在其中的位置;如果当前点不能作为当前最长子序列的最大值,则更新找到值为两者间的较小值。2533 就是一个裸的最长上升子序列...
分类:其他好文   时间:2014-07-30 20:13:04    阅读次数:230
贪心算法练习:乘船问题
/*--------------------------------------------------------------有n个人,第i个的重量为wi,每艘船的最大载重为c,而且最多只能乘两个人。用最少的船装载所有人。输入:第一行两个整数n和c第二行n个整数,分别是wi输出:第一行输出使用船的...
分类:其他好文   时间:2014-07-29 21:49:02    阅读次数:460
ZOJ--1655--Transport Goods【dijkstra】
题意:某国首都正被攻打,需要运送物资到首都,告诉你n个点,编号1~n,n是首都,剩下的点各有wi重量的物资,m条路,每条路有个货物损失比例,现需要求出最多能运送多少货物到首都。 其实转换一下就是一个最短路问题,边的权值是损失比例,找损失比例最小的那条路,则能运送的货物最多。 dist数组存放运成功的比例,初始化为0表示运不成。 WA了N发,各种double类型都用int定义的...
分类:其他好文   时间:2014-07-29 15:06:28    阅读次数:250
UVa Problem 10191 Longest Nap (最长打盹时间)
// Longest Nap (最长打盹时间) // PC/UVa IDs: 110404/10191, Popularity: B, Success rate: average Level: 1 // Verdict: Accepted // Submission Date: 2014-07-28 // UVa Run Time: 0.018s // // 版权所有(C)2014,邱秋。meta...
分类:其他好文   时间:2014-07-29 14:57:08    阅读次数:223
HDU 2126 Buy the souvenirs
Buy the souvenirs Time Limit: 10000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 927    Accepted Submission(s): 319 Problem Description When the wi...
分类:其他好文   时间:2014-07-29 14:34:23    阅读次数:231
Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. Fo...
分类:其他好文   时间:2014-07-29 14:28:48    阅读次数:218
java常用工具方法2
/* * Copyright 2005 Joe Walker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance wi...
分类:编程语言   时间:2014-07-29 13:53:20    阅读次数:484
[LeetCode] Palindrome Partitioning II (DP)
Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ...
分类:其他好文   时间:2014-07-29 13:43:58    阅读次数:223
最长回文字串 (The longest palindrome substring)
这两天去学了一下,觉得下面那篇文章写的很好,有例子,比较容易懂,所以转一下。以下内容来自:hihoCoder:小Hi和小Ho是一对好朋友,出生在信息化社会的他们对编程产生了莫大的兴趣,他们约定好互相帮助,在编程的学习道路上一同前进。这一天,他们遇到了一连串的字符串,于是小Hi就向小Ho提出了那个经典...
分类:其他好文   时间:2014-07-29 12:41:26    阅读次数:292
AI---TinyDB的使用
//从数据库TinyDB1中读出"nameList"列的值并赋值给列表变量nameList,如果数据库中不存在"nameList"列,则将空列表赋值给nameList变量。//判断nameList变量是否为空,如果不为空,则遍历每一个元素,并输出。//segment相当于subString()函数,...
分类:数据库   时间:2014-07-29 11:34:46    阅读次数:517
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!