码迷,mamicode.com
首页 >  
搜索关键字:php array 数组    ( 182180个结果)
HDU 4803 Poor Warehouse Keeper(贪心)
http://acm.hdu.edu.cn/showproblem.php?pid=4803 贪心的策略是,每次尽量加价格,加到能满足...
分类:其他好文   时间:2014-05-16 01:50:53    阅读次数:289
LeetCode 012 Integer to Roman
【题目】 Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 【题意】 给定一个整数,将其表示成罗马数字 【思路】 罗马数字中只使用如下七个基值字母:M,D,C,L,X,V,I,分别用来表示1000、500、100、50、10、5、1。 罗马数组数规则: 基本数字Ⅰ、X 、C 中的任何一个,自身连用构成数目,或者放在大数的右边连用...
分类:其他好文   时间:2014-05-16 01:46:55    阅读次数:312
Best Time to Buy and Sell Stock I && II && III
题目1:Best Time to Buy and Sell Stock Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie,...
分类:其他好文   时间:2014-05-16 01:46:15    阅读次数:460
线性表之顺序存储结构(C语言动态数组实现)
线性表的定义:N个数据元素的有限序列 线性表从存储结构上分为:顺序存储结构(数组)和 链式存储结构(链表) 顺序存储结构:是用一段连续的内存空间存储表中的数据 L=(a1,a2,a3....an) 链式存储结构:是用一段一段连续的内存空间存储表中每一行的数据,段与段之间通过一个引用(指针)相互连接来,形成一个链式的存储结构  看到顺序存储结构的图示,我们可能会马上联想到C语言的数组...
分类:编程语言   时间:2014-05-16 01:43:08    阅读次数:359
[LeetCode]3Sum
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero....
分类:其他好文   时间:2014-05-16 01:34:36    阅读次数:293
绝对值最小
题目描述: ?? 给你一个数组A[n],请你计算出ans=min(|A[i]+A[j]|)(0<=i,j<n). 例如:A={1, 4, -3}, 则: |A[0] + A[0]| = |1 + 1| = 2. |A[0] + A[1]| = |1 + 4| = 5. |A[0] + A[2]| = |1 + (-3)| = 2. |A[1] + A[1]| = |4 + 4| = 8. |A...
分类:其他好文   时间:2014-05-15 23:52:22    阅读次数:426
HDU 4811 Ball(贪心)
http://acm.hdu.edu.cn/showproblem.php?pid=4811 推理一下,发现可以先求出后面放小球可以加分的最大值,然后前面的和为0 + 1 + 2 + ...+ max,max最大为6,因为每个球最多算左右两边 代码: #include #include using namespace std; long long a, b, c; long long ...
分类:其他好文   时间:2014-05-15 23:04:28    阅读次数:387
java集合排序问题
List: 元素是有序的,元素可以重复,因为该集合体系有索引(脚标)常用的子类对象:1————ArrayList 底层的数据结构是使用的数组结构特点:查询速度快,但是增删比较慢2————LinkedList底层的数据结构使用的是链表结构特点:增删速度快,但是查询比较慢Vector 底层是数组数据结构...
分类:编程语言   时间:2014-05-15 22:21:45    阅读次数:388
使用typedef语句定义数组类型
使用typedef语句定义数组类型1. 一维数组类型的定义格式typedef [];例如:(1) typedef int vector[10];(2) typedef char strings[80];(3) typedef short int array[N];第一条语句定义了一个元素类型为int...
分类:其他好文   时间:2014-05-15 22:13:17    阅读次数:244
java之折半查找
//功能:二分查找import java.util.*;public class Demo1 { public static void main(String[] args) { int arr[]={2,5,7,12,25};//定义arr数组并赋值 System.out.print("请输入你需...
分类:编程语言   时间:2014-05-15 22:11:22    阅读次数:421
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!