题目:给你Fib数列的前两项,求第n项的后m位的值。
分析:矩阵快速模幂。见本博客的:斐波那契数列
说明:╮(╯▽╰)╭。
#include
#include
#include
#include
#include
#include
using namespace std;
class matrix
{
private:
int data[2][2];
public:
...
分类:
其他好文 时间:
2015-05-11 21:59:24
阅读次数:
141
首先定义一个数组,int[] a = { 3,1,2,4},我们要简单的实现该数组的排序,但是a数组是System空间下的,没有OrderBy()之类的方法,这是我们引入命名空间using System.Linq之后可以看见又该方法了。给个简单的例子如下:
using System;
using System.Linq;
namespace 对象初始化器
{
class Program...
分类:
编程语言 时间:
2015-05-11 21:58:56
阅读次数:
176
#include
#include
#include //OpenCV包含头文件
#include
#include //容器头文件
using namespace std;
using namespace cv;
int valuearray[255] = {0};//记录连通域数值对应关系
class colorobj
{
public:
int value;
Scalar...
分类:
编程语言 时间:
2015-05-11 21:56:59
阅读次数:
831
using System;
using System.Linq;
namespace LINQ语法实现
{
class Program
{
static void Main(string[] args)
{
int[] a = { 3,1,2,4};
//1.Query syntax
...
分类:
其他好文 时间:
2015-05-11 21:56:58
阅读次数:
119
Given a roman numeral, convert it to an integer.
Input is guaranteed to be within the range from 1 to 3999.
class Solution {
public:
int romanToInt(string s) {
unordered_map mp = {{"M",...
分类:
其他好文 时间:
2015-05-11 21:55:41
阅读次数:
133
Given an integer, convert it to a roman numeral.
Input is guaranteed to be within the range from 1 to 3999.
class Solution {
public:
string intToRoman(int num) {
map mp = {{1000,"M"},{9...
分类:
其他好文 时间:
2015-05-11 21:55:30
阅读次数:
130
转载http://blog.sina.com.cn/s/blog_69dd1a090101fc59.html问题始于学习数据结构,自己编写一个单链表,其中用到了重载输出运算符 class List{2 friend std::ostream& operator & slist);3 ...
分类:
其他好文 时间:
2015-05-11 21:42:47
阅读次数:
124
在学I/O流之前,我先总结一下使用File类操作文件或目录的属性。package com.File;import java.io.File;import java.io.IOException;public class FileDemo { /** * @param args ...
分类:
其他好文 时间:
2015-05-11 21:42:24
阅读次数:
102
1 import java.io.*; 2 3 public class TestObjectIO { 4 public static void main(String args[]) throws Exception { 5 T t = new T(); 6 ...
分类:
编程语言 时间:
2015-05-11 21:42:07
阅读次数:
158
public T findObjectByID(Serializable id){ ParameterizedType pt=(ParameterizedType ) this.getClass.getGenericSuperClass();Class entity=(Clas...
分类:
其他好文 时间:
2015-05-11 21:39:34
阅读次数:
99