码迷,mamicode.com
首页 >  
搜索关键字:Arrays    ( 3585个结果
UVA 1326 Jurassic Remains 中途相遇法
题目链接:点击打开链接 题意:给定n个字符串,选尽可能多的字符串使得每种字母出现的次数为偶数次 思路: 中途相遇法 import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator...
分类:其他好文   时间:2015-01-25 15:19:07    阅读次数:134
CSU 1350 To Add Which? 给序列增加最少的值使得相邻数差<=D 优先队列+贪心
题目链接: import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; import java.ut...
分类:其他好文   时间:2015-01-24 20:07:55    阅读次数:211
CF GYM 100548 The Problem Needs 3D Arrays(2014ACM西安现场赛Problem C)
知识点: 最大密度子图、最大权闭合图、最小割。 题目大意: 给出1~n这n个正整数的一种排列P,要求在P中找出一个子序列S,使得子序列中包含的逆序数对数r(S)和子序列的长度l(S)的比值最大。输出这个最大的比值r(S)/ l(S)。 解题思路: 可以将每个数看成图中的点,将逆序对的关系转换为图中的边。即构成了一个无向图。样例可以转换为下图: 现在要求的就是在图中选取一些点,以及他们互相之间相连的边,构成一个闭合子图。使得图中的边数(逆序对数)与点数(选取的数字)的比值最大。这就是一个最...
分类:其他好文   时间:2015-01-24 15:56:03    阅读次数:446
【leetcode】Median of Two Sorted Arrays
Median of Two Sorted ArraysThere are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run...
分类:其他好文   时间:2015-01-24 15:49:37    阅读次数:78
CSU 1354 Distinct Subsequences 求不同子序列和 dp
题目链接:点击打开链接 题意: 给定一个长整数 求所有不同的子序列和。 思路: dp[i]表示以i数字为结尾的序列的和 num[i]表示以i数字为结尾的序列个数 import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; i...
分类:其他好文   时间:2015-01-23 20:10:12    阅读次数:164
一月二十二日星期四
数组找重复算法demo. 从吃完晚饭折腾到晚上.还在完善中... import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; public class Fi...
分类:其他好文   时间:2015-01-23 00:32:44    阅读次数:180
UVALive 3621 Power Calculus n次幂最少需要几次乘除得到 搜索
题目链接:点击打开链接 题意: 输入一个n(n 问:有一个x,最少需要几次乘除可以算出x^n。 思路: 记忆化搜索 import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparat...
分类:其他好文   时间:2015-01-22 21:53:19    阅读次数:249
leetcode 【 Merge Sorted Array 】python 实现
题目:Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or eq...
分类:编程语言   时间:2015-01-21 23:53:45    阅读次数:175
Median of Two Sorted Arrays
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be ...
分类:其他好文   时间:2015-01-21 21:58:16    阅读次数:273
Median of Two Sorted Arrays
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).   最后从medianof two sorted arrays中看到...
分类:其他好文   时间:2015-01-21 16:31:27    阅读次数:123
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!