js中处处是对象,面向对象的第一步当然就是封装了,由于Js中没有类的概念,所以封装起来也比较麻烦,下面介绍两种js的封装。
1、使用约定优先的原则,将所有的私有变量以_开头
/**
* 使用约定优先的原则,把所有的私有变量都使用_开头
*/
var Person = function (no, name, age)...
分类:
编程语言 时间:
2014-05-07 08:30:05
阅读次数:
411
类型一:可分割性的物品
此类型为贪心问题
背包问题
时间限制:3000 ms | 内存限制:65535 KB
难度:3
描述现在有很多物品(它们是可以分割的),我们知道它们每个物品的单位重量的价值v和重量w(1<=v,w<=10);如果给你一个背包它能容纳的重量为m(10<=m<=20),你所要做的就是把物品装到背包里,使背包里的物品的价值总和最大。
...
分类:
其他好文 时间:
2014-05-07 08:29:24
阅读次数:
343
语言模型 概率语言模型 神经概率语言模型 Deeplearning...
分类:
其他好文 时间:
2014-05-07 08:28:47
阅读次数:
431
Problem Description
You are given a sequence of n integers a1 , a2 , ... , an in non-decreasing order. In addition to that, you are given several queries consisting of indices i and j (1 ≤ i ≤ j ≤ ...
分类:
其他好文 时间:
2014-05-07 07:59:11
阅读次数:
309
原题POJ 3487
稳定婚姻问题的解法,男士主动,女士被动,每次找一个光棍的男士对他最满意的女士求婚,如果女士是未婚或者女士当前的未婚夫在女士心目中不如他,就把男士定为女士的未婚夫,一直进行循环。
#include
#include
#include
#include
#include
#define maxn 1000
using namespace std;
int pref[maxn]...
分类:
其他好文 时间:
2014-05-07 07:43:34
阅读次数:
313
题目链接:
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1836
Number Puzzle
Time Limit: 2 Seconds Memory Limit: 65536 KB
Given a list of integers (A1, A2, ..., An), and a posi...
分类:
其他好文 时间:
2014-05-07 07:42:49
阅读次数:
332
Paint the Grid Again
Time Limit: 2 Seconds
Memory Limit: 65536 KB
Leo has a grid with N × N cells. He wants to paint each cell with a specific color (either black or white).
Leo has a...
分类:
其他好文 时间:
2014-05-07 06:56:10
阅读次数:
470
Video Surveillance
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 3145
Accepted: 1391
Description
A friend of yours has taken the job of security officer at...
分类:
其他好文 时间:
2014-05-07 06:49:43
阅读次数:
387
在战争年代,战争双方时不时受到敌军飞机的轰炸,于是人们发明了航空警报,并派几个侦察兵放哨,一但敌机来临,立即拉响航空警报,这样所有的收听者就能听到报警逃跑。上述情节,看似平常,其实是观察者模式是完美体现。...
分类:
其他好文 时间:
2014-05-07 06:49:06
阅读次数:
342