基础练习 高精度加法
时间限制:1.0s 内存限制:512.0MB
问题描述
输入两个整数a和b,输出这两个整数的和。a和b都不超过100位。
算法描述
由于a和b都比较大,所以不能直接使用语言中的标准数据类型来存储。对于这种问题,一般使用数组来处理。
定义一个数组A,A[0]用于存储a的个位,A[1]用于存储a的十位,依此类推。同样...
分类:
其他好文 时间:
2014-05-26 06:14:46
阅读次数:
201
基础练习 阶乘计算
时间限制:1.0s 内存限制:512.0MB
问题描述
输入一个正整数n,输出n!的值。
其中n!=1*2*3*…*n。
算法描述
n!可能很大,而计算机能表示的整数范围有限,需要使用高精度计算的方法。使用一个数组A来表示一个大整数a,A[0]表示a的个位,A[1]表示a的十位,依次类推。
将a乘以一个整数k...
分类:
其他好文 时间:
2014-05-26 05:27:07
阅读次数:
271
思路:1、排序,取前k个元素;O(NlogN);2、分治,O(n),利用快排的思想;3、用set 维护最小的k个数,O(NlogK),可处理海量数据。...
分类:
其他好文 时间:
2014-05-26 03:38:58
阅读次数:
222
一、编译环境的准备 yum install gcc yum install gcc-c++ libstdc++-devel yum install zlib-devel二、源码包准备wget http://monkey.org/~provos/libevent-1.4.14b-stable.tar.gzwget http://memcached.googlecode.com/files/me...
分类:
系统相关 时间:
2014-05-26 03:38:01
阅读次数:
375
1.课程安排表:
1. 线性表
2. 字符串
3. 栈和队列
4.树
5.查找
6.排序
7.暴力枚举法
8.广度优先搜索
9.深度优先搜索
10.分治
11.贪心
12.动态规划
13.图
14.数学方法与常见模型
15.大整数运算
16. 基础功能
2. 编程技巧:
1.把较大的数组放在main 函数(全局变量)外,作为全局变量,这样可以防止栈溢出,...
分类:
其他好文 时间:
2014-05-25 00:31:30
阅读次数:
348
【题目】
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
For example, given the array [?2,1,?3,4,?1,2,1,?5,4],
the contiguous subarray [4,?1,2,1] has the largest sum = 6.
【题意】
给定一个数组,找出和最大的子数组,返回...
分类:
其他好文 时间:
2014-05-24 22:19:17
阅读次数:
260
题目
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.
Here, we will use the i...
分类:
其他好文 时间:
2014-05-24 20:30:21
阅读次数:
342
/**
* Created by W.J.Chang on 2014/5/23.
*/
// 判读是否是数组的方法
console.log(Array.isArray(new Array));
console.log(Array.isArray([]));
var arr = [1,2,3];
// 遍历方法
arr.forEach(function (v){
console.log...
分类:
Web程序 时间:
2014-05-24 18:01:08
阅读次数:
305
让数组中基数位于偶数的前面,用快排的思想解决。...
分类:
其他好文 时间:
2014-05-24 17:10:26
阅读次数:
170