南阳oj入门题-Fibonacci数

68页|大型车企集团数字化转型汽车数字化信息系统平台规划方案 这份PPT文档提供了一个全面的汽车集团数字化转型规划方案,涵盖了项目目标、规划思路、实施关注点、解决方案建议以及合作优势等多个方面。 阅读详情
/**
Fibonacci数
时间限制:3000 ms  |  内存限制:65535 KB
难度:1
描述
无穷数列1,1,2,3,5,8,13,21,34,55...称为Fibonacci数列,它可以递归地定义为
F(n)=1 ...........(n=1或n=2)
F(n)=F(n-1)+F(n-2).....(n>2)
现要你来求第n个斐波纳奇数。(第1个、第二个都为1)
输入
第一行是一个整数m(m<5)表示共有m组测试数据
每次测试数据只有一行,且只有一个整形数n(n<20)
输出
对每组输入n,输出第n个Fibonacci数
样例输入
3
1
3
5
样例输出
1
2
5
*/
#include<iostream>
#include<stdlib.h>
using namespace std;
int Fibon(int n)
{
	if(n==1||n==2)
		return 1;
	else
		return Fibon(n-1)+Fibon(n-2);		
} 
int main()
{
	int n;
	cin>>n;
	while(n--)
	{
		int m;
		cin>>m;
		cout<<Fibon(m)<<endl;
	}
	return 0;
}

 

Halcon阈值算子 -- 局部阈值之dyn_threshold Halcon阈值算子 – dyn_threshold HALCON有很多阈值算子,接下来将一一介绍。本文先介绍dyn_threshold。 以下介绍主要参考HALCON帮助文档,并加上自己的体会。如有纰漏,欢迎留言指出 理论介绍 dyn_threshold算子的函数签名如下: dyn_threshold(OrigImage, ThresholdImage : RegionDynThresh : Offset, LightDark : ) 输入参数有: OrigImage:待处理图像 ThresholdIm 阅读详情

相关推荐

黑客渗透测试后门隐藏技术揭秘

本文介绍了在授权渗透测试中隐藏后门文件(muma.exe)的多种技术手段。主要包括:通过WinRAR自解压脚本将后门与正常程序捆绑实现双开;利用系统自动运行目录和注册表实现开机自启;修改文件图标伪装成常用软件;将文件存放在冷门系统目录;设置系统+隐藏双重属性增强隐蔽性。此外还涉及对抗安全软件的加壳(UPX)、免杀(msfvenom编码)技术,以及进程注入、日志清除等运行隐藏方法。所有技术仅限合法授权测试使用,未经授权使用将面临法律责任。

m0_60781580的博客 1041

/*编写一个程序,利用函数递归求斐波那契数列的前几项是:1,1,2,3,5,8,13,21,34...。编程输出该数列的前20项,每行输出5个数。

[ f(n)=f(n-1)+f(n-2), 且f(1)=1,f(2)=1] */ #include<stdio.h> int add(int x) { int sum = 0; if (x==1||x==2) { sum = 1; } else if (x>2) { sum = add(x - 1) + add(x - 2); } else { printf("输入数据有误!!!...

Python202109的博客 2381

【遥感数字图像处理(朱文泉)】第四章 变换域处理方法

变换域的处理方法

甜子yu的博客 4312

Fibonacci数

描述 无穷数列1,1,2,3,5,8,13,21,34,55...称为Fibonacci数列,它可以递归地定义为 F(n)=1 ...........(n=1或n=2) F(n)=F(n-1)+F(n-2).....(n>2) 现要你来求第n个斐波纳奇数。(第1个、第二个都为1) 输入 第一行是一个整数m(m 每次测试数据只有一行,且只有一个整形数n(n 输出 对每组输入n,

标哥 880

HI3403烧录全流程:从ToolPlatform安装到eMMC配置避坑指南

本文详细介绍了海思HI3403芯片的完整烧录流程,涵盖从ToolPlatform工具安装、驱动配置到eMMC分区策略的实战指南。文章深入解析了BurnTool工具的使用方法、关键配置项,并提供了烧录过程中的常见问题排查与解决方案,旨在帮助开发者高效、稳定地完成HI3403嵌入式系统的部署。

weixin_29279101的博客 335

Python爬虫实战:如何优雅地处理BOSS直聘的反爬机制与Cookie失效问题

本文详细介绍了如何通过Python爬虫技术优雅应对BOSS直聘的反爬机制与Cookie失效问题。从多账号轮换、动态请求头生成到代理IP管理,提供了一套完整的解决方案,帮助开发者构建稳定高效的数据采集系统,有效提升爬虫成功率与数据质量。

weixin_30733003的博客 1564

使用python实现斐波那契数列的四种方法

第一种方法实现(顺序输出) 第二种方法实现(利用python的组包拆包原理) 第三种方法实现(利用递归函数实现) 第四种方法实现(利用列表实现)

但行好事,莫问前程 3万+

APB Timer验证环境搭建——学习笔记(1)

以下为个人学习笔记,如有疏漏,请大家指正补充~~APB Timer是一个简单的下行计数器,包括一个32位计数器和一组比较器,可以实现多种计时功能。包括生成一次性中断或者定时中断。

qq_41651535的博客 1579

热爱数学,从学习LaTex开始

我只是来学习打数学符号的。 0.markdown中使用LaTeX需要在$$中打数学符号 1.如何插入公式 的数学公式有两种:行中公式和独立公式。行中公式放在文中与其它文字混编,独立公式单独成行。 行中公式可以用如下方法表示: $ 数学公式 $ 独立公式可以用如下方法表示:$$ 数学公式 $$ 数学公式 数学公式 数学公式 1.上下标 ^代表上标,_代表下标 如果上标或下标内容多于一个字符,则使...

Freopen的博客 1159

【Agent】多智能体框架MetaGPT入门教程

创建一个 Action 类的子类 SimpleWriteCode,子类中定义好 prompt,并解析返回结果。在 MetaGPT 中,

酒酿小圆子呀~ 3147

Look4sat蓝牙追星云台

//这是一个追星云台的小程序 //配合Look4sat蓝牙传输数据(W*** A***),并让电机做出动作 //app设置内填好ESP32的蓝牙MAC,数据格式:W$AZ A$EL //希望大家可以共同改进

HoyAnGx的博客 619

fibonacci数列-斐波那契数列-python编程

未完待续~ 了解fibonacci数列: 斐波纳契数列(Fibonacci Sequence),又称黄金分割数列。 1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765……(1)fibonacci数列即斐波那契数列,它的特点是前面两个数的和等于后面的一个数,fib(0)=fib(1)=1.(2)斐波那契...

1420

3、流程引擎下载安装与部署

camunda有多种使用方式,此处先使用独立平台的方式部署引擎,这种用法适合分布式,微服务化,多语言异构系统的使用方式。

leyoliu的博客 5524

南阳oj_(13)Fibonacci数

Fibonacci数 时间限制:3000 ms  |  内存限制:65535 KB  难度:1 描述 无穷数列1,1,2,3,5,8,13,21,34,55...称为Fibonacci数列,它可以递归地定义为 F(n)=1 ...........(n=1或n=2) F(n)=F(n-1)+F(n-2).....(n>2) 现要你来求第n个斐波纳奇数。(第1个、第二个

槑头脑的博客 397

深度学习工具包 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")

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

南阳理工OJ_Fibonacci数

/*   * 程序的版权和版本声明部分:   * Copyright (c) 2013,郑州大学SIAS国际学院   * 文件名称:  Fibonacci数 * 作    者:       王  杰 * 完成日期:20 年10  月 26 日     * 对任务及求解方法的描述部分:  * 输入描述:   * 问题描述: * 程序输出:   * 问题分析:  * 算法设计:

王 杰的专栏 943

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

Fibonacci数 南阳理工ACM 题目13

做的越多才发现自己会的很少, 本体就是使用递归调用,它可以递归地定义为 F(n)=1 ...........(n=1或n=2) F(n)=F(n-1)+F(n-2).....(n&gt;2)   Fibonacci数 时间限制:3000 ms  |  内存限制:65535 KB 难度:1 输入 第一行是一个整数m(m&lt;5)表示共有m组测试数据 每次测试数据只有一行,且只有一...

小博士的博客 285

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

南阳OJ_语言入门_13 Fibonacci数

Fibonacci数 时间限制:3000 ms  |  内存限制:65535 KB 难度:1 描述无穷数列1,1,2,3,5,8,13,21,34,55...称为Fibonacci数列,它可以递归地定义为 F(n)=1 ...........(n=1或n=2) F(n)=F(n-1)+F(n-2).....(n>2) 现要你来求第n个斐波纳奇数。(第1个、第二个都为

276

南阳理工OJ 13 Fibonacci数

Fibonacci数 时间限制:3000 ms  |  内存限制:65535 KB 难度:1描述 无穷数列1,1,2,3,5,8,13,21,34,55...称为Fibonacci数列,它可以递归地定义为F(n)=1 ...........(n=1或n=2) F(n)=F(n-1)+F(n-2).....(n&gt;2)现要你来求第n个斐波那契数。(第1个、第二个都为1...

Sunnianer的博客 191

【NYOJ】[13]Fibonacci数

发现南阳理工OJ能上了 而且速度挺快 来写一写分类里面的入门题吧~ 啊哈啊哈 偶尔颓废一下也不要紧嘛

BoilTask Talk Show 519

南阳oj 题目13 Fibonacci数

Fibonacci数 时间限制:3000 ms  |  内存限制:65535 KB 难度:1 描述无穷数列1,1,2,3,5,8,13,21,34,55...称为Fibonacci数列,它可以递归地定义为 F(n)=1 ...........(n=1或n=2) F(n)=F(n-1)+F(n-2).....(n>2) 现要你来求第n个斐波纳奇数。(第1个、第二个都为

jianjun的专栏 732

南阳OJ题目13---Fibonacci数

Fibonacci数时间限制:3000 ms  |  内存限制:65535 KB难度:1描述无穷数列1,1,2,3,5,8,13,21,34,55...称为Fibonacci数列,它可以递归地定义为F(n)=1 ...........(n=1或n=2)F(n)=F(n-1)+F(n-2).....(n&gt;2)现要你来求第n个斐波那契数。(第1个、第二个都为1)输入第一行是一个整数m(m&lt;...

Prime的博客 322

南阳OJ 461 Fibonacci数列(四)

描述 数学神童小明终于把0到100000000的Fibonacci数列(f[0]=0,f[1]=1;f[i] = f[i-1]+f=2”>i-2)的值全部给背了下来。 接下来,CodeStar决定要考考他,于是每问他一个数字,他就要把答案说出来,不过有的数字太长了。所以规定超过4位的只要说出前4位(高4位)就可以了,可是CodeStar自己又记不住。于是他决定编写一个程序来测验小明说的是否正确。

qiaomm的个人博客 707

南阳理工oj 13-Fibonacci数

题目描述: 无穷数列1,1,2,3,5,8,13,21,34,55…称为Fibonacci数列,它可以递归地定义为 F(n)=1 …(n=1或n=2) F(n)=F(n-1)+F(n-2)…(n&gt;2) 现要你来求第n个斐波那契数。(第1个、第二个都为1) 输入描述: 第一行是一个整数m(m&lt;5)表示共有m组测试数据 每次测试数据只有一行,且只有一个整形数n(n&lt;20) 输出描述:...

m0_37220818的博客 201

[南阳OJ-No.13]Fibonacci数|无穷数列1,1,2,3,5,8,13,21,34,55...称为Fibonacci数列,它可以递归地定义为 F(n)=1 ...........(n=1或

南阳OJ-No.13 时间限制:3000ms,空间限制:65535KB 描述 无穷数列1,1,2,3,5,8,13,21,34,55…称为Fibonacci数列,它可以递归地定义为 F(n)=1 ………..(n=1或n=2) F(n)=F(n-1)+F(n-2)…..(n>2) 现要你来求第n个斐波纳奇数。(第1个、第二个都为1) 输入 第一行是一个整数m(m 每次测试数据只有

dj741的博客 8970

Python 中如何实现斐波那契数列递归函数?

斐波那契数列是这样一个数列:1, 1, 2, 3, 5, 8, 13, 21, 34, ...... 该数列从第三项开始,每一项都等于前两项之和。

devid008的博客 3200

C语言实例:斐波那契数列

斐波那契数列指的是这样一个数列 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368…这个数列从第3项开始,每一项都等于前两项之和。要求:从控制台获取斐波那契数列的数量,输出指定数列。 实现方法1:使用 for循环,将t1赋值第1个数,t2赋值第2个数,计算出第3个数,输出第1个数。然后再将t1赋值第2个数,t2赋值第3个数,计算出第4个数,输出第2个数。以

st66688的博客 5523
上一篇: 南阳oj入门题-奇偶数分离
下一篇: 南阳oj入门题-素数求和问题
mind_programmonkey
mind_programmonkey 领域专家: 算法与数据结构技术领域 领域专家: 算法与数据结构技术领域
博客等级 码龄9年 4435粉丝 1111原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值