LeetCode: Decode WaysA message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given a...
分类:
其他好文 时间:
2014-09-01 00:11:12
阅读次数:
247
前几天,我才知道有一种简化的数据交换格式,叫做yaml。我翻了一遍它的文档,看懂的地方不多,但是有一句话令我茅塞顿开。它说,从结构上看,所有的数据(data)最终都可以分解成三种类型:第一种类型是标量(scalar),也就是一个单独的字符串(string)或数字(numbers),比如"北京"这个单...
分类:
Web程序 时间:
2014-08-31 21:26:21
阅读次数:
258
Minimum Path SumGiven amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along ...
分类:
其他好文 时间:
2014-08-31 19:59:31
阅读次数:
209
这题目最坑了,我做的A题最坑的一道1,首先输入数据不一定是四位的,泪奔,输入1,222,222,试一试2,在运行过程中需要判定结果是否为0,需要跳出#include#include#includeusing namespace std;void get(char * data,int & max,i...
分类:
其他好文 时间:
2014-08-31 19:57:51
阅读次数:
240
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
If such arrangement is not possible, it must rearrange it as the lowest possible...
分类:
其他好文 时间:
2014-08-30 20:30:10
阅读次数:
254
Problem H{sum+=i++} to Reach NInput:standard inputOutput:standard outputMemory Limit:32 MBAll the positive numbers can be expressed as a sum of one, t...
分类:
其他好文 时间:
2014-08-30 16:21:39
阅读次数:
149
题目链接
题意:斐波那契数列,当长度大于8时,要输出前四位和后四位
思路:后四位很简单,矩阵快速幂取模,难度在于前四位的求解。
已知斐波那契数列的通项公式:f(n) = (1 / sqrt(5)) * (((1 + sqrt(5)) / 2) ^ n - ((1 + sqrt(5)) / 2) ^ n),当n >= 40时((1 + sqrt(5)) / 2) ^ n近...
分类:
其他好文 时间:
2014-08-30 15:11:21
阅读次数:
288
Young cryptoanalyst Georgie is investigating different schemes of generating random integer numbers
ranging from 0 to m - 1.
He thinks that standard random number generators are not good enough, s...
分类:
其他好文 时间:
2014-08-29 21:26:38
阅读次数:
317
#include "stdafx.h"#include #include #include using namespace std;void print(int numbers[], int size){ for (int i = 0; i = high) return; const i...
分类:
其他好文 时间:
2014-08-29 19:41:48
阅读次数:
263
Harry is a Junior middle student. He is very interested in the story told by his mathematics teacher about the Yang Hui triangle in the class yesterday. After class he wrote the following numbers to s...
分类:
其他好文 时间:
2014-08-29 14:42:38
阅读次数:
275