第19 题: 题目:定义Fibonacci 数列如下: / 0 n=0 f(n)= 1 n=1 \ f(n-1)+f(n-2) n=2

斐波那契数列 斐波那契(Fibonacci)数列的定义是这样的: F(1)=1 F(2)=1 F(N)=F(N-1)+F(N-2) (N>=3) 请计算第N项斐波那契的值. 输入描述 输入数据只包含一个正整数N(1<N<100000); 输出描述 请根据要求计算输出F(N)的结果,为方便计算,只要求输出F(N) MOD 2000000003 后的值. 输入样例 4 输出样例 3 立即下载
输入n,用最快的方法求该数列的第n 项。
分析:在很多C 语言教科书中讲到递归函数的时候,都会用Fibonacci 作为例子。

因此很多程序员对这道题的递归解法非常熟悉,但....呵呵,你知道的。


思路:

    f(n) = 1*f(n-1) +1* f(n-2);

   f(n-1)=1*f(n-1)+ 0*f(n-2);

   f(n)        1   1        f(n-1)

   f(n-1)     1   0        f(n-2)    ,这里是使用的是矩阵,这样可以计算得出f(n),f(n-1)    与   f(1) , f(0) 的矩阵关系。


   在计算矩阵的幂的时候可以利用快速矩阵求法。求a的n次方的快速求法:

  while(a > 0)

           do  { 

if ( a%2 == 1){

                               result = a*result;

n = n -1;}

                 a=a*a;

  n = n/2;}

算法复杂度分析:算法的复杂度主要考虑的是矩阵的n次方幂,由于每次都是n = n/2 ,所以矩阵的快速幂复杂度O(lg n)。 

#include <iostream>

using namespace std;

int main()
{
	int a[4] = {1,1,1,0};//前面讨论过
	int b[4] = {1,0,0,1};//单位阵
	int n,a1,a2,a3,a0;

	cin >> n;

	if (n == 0)
	{
		cout << "0";
		return 0;
	}
	if (n == 1)
	{
		cout << "1";
		return 1;
	}
	n = n-1;
	while ( n > 0 )
	{
		if ( n%2 == 1 )
		{
			n = n - 1;
			a0 = b[0]*a[0] + b[1]*a[2];
			a1 = b[0]*a[1] + b[1]*a[3];
			a2 = b[2]*a[0] + b[3]*a[2];//此处实际上不用更新b[2],b[3]
			a3 = b[2]*a[1] + b[3]*a[3];
			b[0] = a0;b[1] = a1;b[2] = a2;b[3] = a3;
		}
		n = n/2;
		a0 = a[0]*a[0] + a[1]*a[2];
		a1 = a[0]*a[1] + a[1]*a[3];
		a2 = a[2]*a[0] + a[3]*a[2];
		a3 = a[2]*a[1] + a[3]*a[3];
		a[0] = a0;a[1] = a1;a[2] = a2;a[3] = a3;
	}

	cout << b[0];
	return 0;
}




手把手教你在全新服务器内网安装OpenEuler 22.03 LTS SP4+ 安装 openGuass 5.0.0(LTS) 数据库 openEuler是面向数字基础设施的操作系统,支持服务器、云计算、边缘计算、嵌入式等应用场景,支持多样性计算,致力于提供安全、稳定、易用的开源服务器Linux操作系统。 阅读详情

相关推荐

Pspice安装教程:Windows系统完整指南(含环境变量设置)

详细讲解在Windows系统中完成Pspice安装的全过程,涵盖安装步骤与关键的环境变量设置,帮助用户顺利运行仿真工具。适合初学者快速上手pspice安装教程中的核心环节。

weixin_42230607的博客 1181

关于斐波那契数列三种解法及时间复杂度分析

斐波那契数列: f(n)=f(n-1)+f(n-2); n>=2 f(0)=0; f(1)=1; 即有名的兔子繁衍问题。 斐波那契数列共有三种解法,因而写这篇文章总结一下。 1. 递归求解 递归求解比较简单,是大家常见的一种解法。int fibonacci(int n) { cout<<"calculat

beautyofmath的博客 6万+

蓝牙Mesh安全机制全解析:如何防止你的智能门锁被黑客控制?

本文深入解析蓝牙Mesh安全机制,重点探讨如何保护智能门锁免受黑客攻击。详细介绍了蓝牙Mesh的多层次安全架构,包括密钥管理体系、设备入网流程及实战防护策略,帮助用户构建更安全的智能家居网络。

h3i4j的博客 732

9.斐波那契数列

斐波那契数列(Fibonacci sequence),也称之为黄金分割数列,由意大利数学家列昂纳多・斐波那契(Leonardo Fibonacci)提出。斐波那契数列指的是这样的一个数列:1、1、2、3、5、8、13、21、34、……,这个数列从第 3 项开始,每一项都等于前面两项之和。

最棒的yee 281

Mplus实战:如何用交叉滞后面板模型(CLPM)分析心理学纵向数据?

本文提供了在Mplus软件中应用交叉滞后面板模型(CLPM)分析心理学纵向数据的实战指南。文章详细拆解了CLPM的核心概念、Mplus语法框架,并涵盖从基础的两变量模型到多变量、潜变量建模的扩展,以及结果解读与常见陷阱规避,旨在帮助研究者利用这一经典工具有效探索变量间的动态预测关系。

weixin_29253711的博客 405

深入浅出CenterFusion

结合论文和代码理解CenterFusion

Untitled的专栏 5104

求Fibonacci数列的第n项 (模拟加法)

7-45求Fibonacci数列的第n项(30分) 求Fibonacci数列的第n项f[n]. f[0]=1; f[1]=1 ; f[n]=f[n-1]+f[n-2]; 输入格式: 输入一个不超过10000的正整数n。 输出格式: 输出Fibonacci数列的第n项的值。 输入样例: 在这里给出一组输入。例如: 99 输出样例: 在这里给出相应的输出。例如: 354...

lgz0921的博客 3870

【胡学长 带你学 Global Mapper 】如何将影像地图转换为国家2000坐标系

多部门联合开展工作坐标数据不匹配怎么办?Hi,我是胡学长!今天教大家如何利用Global Mapper将谷歌影像数据转换为国家2000坐标系影像数据 。

一起来交流学习吧 1万+

斐波纳契数列(f(n)=f(n-1)+f(n-2))问题

package org.nxt.algorithm.series; import java.math.BigInteger; /** * fibonacci series * @author nanxiaotao * */ public class FibonacciSeries { private static BigInteger[][] matrix(...

nanxiaotao的博客 1万+

智能车实战——极速越野组GPS与惯导融合定位导航全解析

本文深入解析了智能车极速越野组中GPS与惯导模块的融合定位导航技术。通过对比GPS的全局定位与惯导的高频姿态感知,详细阐述了如何利用MM32SPN27主控,将两者数据融合以实现精准、实时的车辆控制。内容涵盖硬件选型、软件数据处理、PID控制及系统调试等实战环节,为智能车开发者提供了一套完整的解决方案。

pz8901234的博客 1204

断层错动和近断层地震动联合作用下软岩隧洞衬砌损伤分析

摘要 本文提出了一种基于Python的软岩隧洞衬砌损伤分析系统,重点研究断层错动和近断层地震动的联合作用效应。系统采用有限元方法建立隧洞-围岩体系模型,通过非线性动力分析评估衬砌结构损伤。研究内容包括:1)建立考虑应变软化的软岩本构模型;2)基于位错理论模拟断层错动过程;3)合成具有速度脉冲效应的近断层地震动;4)开发完整的动力响应分析流程。结果表明,所提出的方法能有效评估软岩隧洞在复杂地质条件下的抗震性能,为工程设计提供理论依据。 关键词:软岩隧洞、断层错动、近断层地震动、损伤分析、Python、有限元法

max500600的博客 845

Interview100-19 输出Fibonacci数列的第n项

题目 一直Fibonacci数列,输入n,用最快的方式求改该数列的第n项。 解法 1. 递归方法。这是一个经典的递归求解方法,我们知道Fibonacci数列的递归式为F(n) = F(n-1)+F(n-2)。这样就可以使用递归的方式求得该数列的第n项。但这种方式总是在计算重复的值,例如计算F(8)时计算了F(1)到F(7),而计算F(9)时有计算了一遍F(1)到F(8),其中F(1)到F(7...

Blossom 361

vue3 - 最新详细实现高德地图绘制动态热力图详细教程,在某区域或城市地图上做“热力图层“展示人流量、旅游人口密度、热量图、全国地区地理热力图,利用颜色的深浅表示密度或强度等场景(详细示例代码教程)

vue3,nuxt3,高德地图,热力图,绘制热力图层,人流量,vue3使用高德地图实现某个区域热力图,vue3高德地图api加载热力图及关闭,接收热力图数据并渲染热力图,关掉热力图,Vue使用高德API制作热力图,热力图加载不出来,电子围栏围住热力图,vue3中使用高德地图渲染热力图组件,高德地图使用热力图详细教程,报错,卡顿,出不来怎么办,无法关闭,怎么解决这个问题,出错,城市名称,城市某个街道,城区,省份,市区,县城,乡镇,村,各省份的热力图,交通流量,人口流量,密度,旅游出行,人口数量,颜色介绍,深浅

✅ 精选推荐文章 5207

hdu 5895 广义Fibonacci数列

Mathematician QSC Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 229Accepted Submission(s): 114 Problem Description QSC dream of ...

diaocuiguo2493的博客 211

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Fibonacci数列

第19题(数组、递归): 题目:定义Fibonacci数列如下:     / 0 n=0 f(n)= 1 n=1   / f(n-1)+f(n-2) n=2 输入n,用最快的方法求该数列的第n项。 //coder:LEE //20120315 #include #include using namespace std; class A { int data[2][

lihappy999的专栏 856

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

计算Fibonacci数列第n项的值(递归)

计算Fibonacci数列第n项的值(递归) (递归函数和全局变量) 程序设计题 #76081 计算Fibonacci数列第n项的值(递归) 计算Fibonacci数列第n项的值(递归) 斐波那契数列(Fibonacci sequence),又称黄金分割数列、因数学家列昂纳多·斐波那契(Leonardoda Fibonacci)以兔子繁殖为例子而引入,故又称为“兔子数列”,指的是这样一个数列:1、1、2、3、5、8、13、21、34、……在数学上,斐波那契数列以如下被以递推的方法定义:F(1)=1,F(2)

weixin_63300614的博客 4230

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

Codeforces - Manthan, Codefest 19A XORinacci(思维 && !Fibonacci)

time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Cengiz recently learned Fibonacci numbers and now he is studying different algorithms to find t...

张洪基 687

求fibonacci数列第n项java_求斐波那契数列的第n项

问题描述:斐波那契数列是这样的一个数列,1,1,2,3,5,8,..,即前两项都是1,后面每一项都是其前面两项的和。现在要你求出该数列的第n项。分析:该问题是一个经典的数列问题,相信大家在很多语言的教科书上都碰到过这个练习题目。这里我给大家总结了三种经典解法,并对这三个方法进行了对比。解法一:递归算法。很多教科书上都用这个题作为函数递归知识点讲解的例题,我们可以将每一个项的求法表达为这样一个式子:...

weixin_39673471的博客 734

19.Fibonacci数列

题目:定义Fibonacci数列如下:    / 0 n=0 f(n)= 1 n=1   / f(n-1)+f(n-2) n=2 输入n,用最快的方法求该数列的第n项。 分析:在很多C语言教科书中讲到递归函数的时候,都会用Fibonacci作为例子。 因此很多程序员对这道题的递归解法非常熟悉,但....呵呵,你知道的。。   这里用到递归,对于输入的你很小时,时间可以

游刃有余则成的专栏 773

蓝桥杯 基础练习 Fibonacci数列

去年没有参加蓝桥杯竞赛,19号马上就要参加校内赛选拔了,加上我又很久没刷蓝桥杯的题了,就先把旧题选着刷一下,记录一下自己敲过程中的一些问题。 这是题目 问题描述 Fibonacci数列的递推公式为:Fn=Fn-1+Fn-2,其中F1=F2=1。 当n比较大时,Fn也非常大,现在我们想知道,Fn除以10007的余数是多少。 输入格式 输入包含一个整数n。 输出格式 输出一行,包含一个整数,表示Fn除以10007的余数。 说明:在本题中,答案是要求Fn除以10007的余数,因此我们只要能算出这

HXC_Hunter的博客 1260

微软面试100题之19题:定义Fibonacci 数列如下,用最快的方法求该数列的第n 项

题目:定义Fibonacci 数列如下: / 0 n=0 f(n)= 1 n=1 \ f(n-1)+f(n-2) n=2 输入n,用最快的方法求该数列的第n 项。 分析:在很多C 语言教科书中讲到递归函数的时候,都会用Fibonacci 作为例子。 因此很多程序员对这道题的递归解法非常熟悉,但....呵呵,你知道的。。

tongxinhaonan的专栏 1671

19.定义Fibonacci数列,输入n,用最快的方法求该数列的第n项

题目:定义Fibonacci数列如下:      / 0 n=0 f(n)= 1 n=1   / f(n-1)+f(n-2) n=2 输入n,用最快的方法求该数列的第n项。 分析:在很多C语言教科书中讲到递归函数的时候,都会用Fibonacci作为例子。 因此很多程序员对这道题的递归解法非常熟悉,但....呵呵,你知道的。。   答案: //20130128#include

zhoutong12589的专栏 2051

Fibonacci数列-兔子问题

“”" NAME : Fibonacci数列.py Author: W Date: 4/8/19 Connect: www.1019022410@qq.com Desc: 列昂纳多·斐波那契(Leonardoda Fibonacci)以兔子繁殖为例子而引入,故又称为“兔子数列”, 指的是这样一个数列:1、1、2、3、5、8、13、21、34、……在数学上,斐波纳契数列以如下被以递推的方法定...

qq_41661056的博客 878

fibonacci数列c语言编程,C语言如何用数组求Fibonacci数列的前N项和?

根据方程组进行解题。用数组来处理求Fibonacci数列问题。解:程序:#includeint main(){int i, f[20] = { 1,1 };//对最前面两个元素f[0]和f[1]赋初值1for (i = 2; i < 20; i++){f[i] = f[i-2]+f[i-1];//先后求出f[2]~f[19]的值}for (i = 0; i<20; i++){if (i...

weixin_34638409的博客 3470

题目 2311: 蓝桥杯2019年第十届省赛真题-Fibonacci 数列与黄金分割

题目 Fibonacci 数列是非常著名的数列: F[1] = 1,F[2] = 1, 对于 i > 3,F[i] = F[i − 1] + F[i − 2] Fibonacci 数列有一个特殊的性质,前一项与后一项的比值,F[i]/F[i + 1], 会趋近于黄金分割。 为了验证这一性质,给定正整数 N,请你计算 F[N]/F[N + 1],并保留 8 位 小数。 输入 一个正整数 N。(1 ≤ N ≤ 2000000000) 输出 F[N]/F[N + 1]。答案保留 8 位小数。 样例输入 2

博客简介 825

微软100题(19)Fibonacci数列

题目:定义Fibonacci数列如下:     /                 0                   n=0            f(n)= 1                   n=1   /                 f(n-1)+f(n-2) n=2 输入n,用最快的方法求该数列的第n项。 递归貌似很容易栈溢出,所以是个不算好的方

liuqing0517的博客 497
上一篇: 第18 题: 题目:n 个数字(0,1,…,n-1)形成一个圆圈,从数字0 开始每次从这个圆圈中删除第m 个数字(第一个为当前数字本身,第二个为当前数字的下一个数 字)。
下一篇: 第21 题 2010 年中兴面试题 编程求解: 输入两个整数n 和m,从数列1,2,3.......n 中随意取几个数, 使其和等于m ,要求将其中所有的可能组合列出来.
Matrixlibing
博客等级 码龄14年 2粉丝 14原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值