策略模式: 定义了一个算法族,分别把每个算法封装起来,让它们之间可以互相替换,此模式让算法的变化独立于使用算法的客户。结构图:C++实现:class calculateStrategy {public: virtual int calculate(int value1, int value2...
分类:
其他好文 时间:
2015-08-17 13:34:25
阅读次数:
96
u Calculate e
Problem Description
A simple mathematical formula for e is
where n is allowed to go to infinity. This can actually yield very accurate approximations of e using relatively...
分类:
其他好文 时间:
2015-08-16 18:26:14
阅读次数:
107
DescriptionGiven a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the ma...
分类:
其他好文 时间:
2015-08-15 22:48:01
阅读次数:
130
原题:DescriptionGiven a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the...
分类:
其他好文 时间:
2015-08-15 18:09:44
阅读次数:
130
Description
Jzzhu has invented a kind of sequences, they meet the following property:
You are given x and y, please calculate fn modulo 1000000007(109?+?7).
Input
The first line cont...
分类:
其他好文 时间:
2015-08-15 16:33:49
阅读次数:
132
DescriptionGiven a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the ma...
分类:
其他好文 时间:
2015-08-14 21:19:06
阅读次数:
134
Max Sum
Problem Description
Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is...
分类:
其他好文 时间:
2015-08-14 19:06:00
阅读次数:
118
点击此处即可传送HIT 2060As we know , the Fibonacci numbers are defined as follows: F(n) == {1 n==0||n==1
{F(n-1)+F(n-2) n>1;
Given two numbers a and b , calculate . 从a到b之间的斐波那契数的和Input The input con...
分类:
其他好文 时间:
2015-08-14 13:46:30
阅读次数:
174
A + B Problem IIProblem DescriptionI have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.InputTh...
分类:
其他好文 时间:
2015-08-13 22:05:09
阅读次数:
97
//
// main.m
// block数据类型
//
// Created by admin on 15/8/12.
// Copyright (c) 2015年 admin. All rights reserved.
//
#import
#import "Calculate.h"
// 定义一个函数
void ...
分类:
移动开发 时间:
2015-08-13 12:21:31
阅读次数:
154