Jzoj4724 斐波那契(待填)

jzoj4726. 【NOIP2016提高A组模拟8.22】种花 贪心+堆 这题思路很巧妙,要借鉴。 题意:给你一个环,选出M个点,任意两个互不相邻,要求总和最大。 一开始想的dp,设f[i][0/1]表示i选不选的最大总和,然后发现i的取值基本上能和他前面所有的值都有关联,由于是个环,所以dp你连预处理都会炸。。如果是个序列就可以这么做,不过在后面复制一遍然后用单调队列优化好像也可以,但那就太不优美了其实是我懒得打 那么我们可以贪心,把所有的数加入大根堆,每次取出最 阅读详情

这道题十分神,挖坑待填

DJL为了避免成为一只咸鱼,来找czgj学习Fibonacci数列。
通过czgj的谆谆教导,DJL明白了Fibonacci数列是这样定义的:
F(1)=1;F(2)=1;F(n)=F(n-1)+F(n-2)(n>2)
Czgj深谙熟能生巧的道理,于是他给了DJL一个数列,并安排了如下的训练计划:
1、“1 L r”,表示给ai 加上F(i-L+1) ,其中L<=i<=r ;
2、“2 L r”,表示询问 ∑a[i](l<=i<=r)%10^9+7的值
DJL经过长时间的学习,感觉身体被掏空,他希望你能帮他解决这个问题。

fibonacci构造矩阵-总结.doc (一)Fibonacci数列f[n]=f[n-1]+f[n-2],f[1]=f[2]=1的第n项的快速求法(不考虑高精度). 解法: 考虑1×2的矩阵【f[n-2],f[n-1]】。根据fibonacci数列的递推关系,我们希望通过乘以一个2×2的矩阵,得到矩阵【f[n-1],f[n]】=【f[n-1],f[n-1]+f[n-2]】 立即下载

相关推荐

斐波那契数列求解(矩阵相乘、直接累加)

分别采用矩阵相乘法(分治递归)和直接累加求和的方法求解第n个斐波那契数

【JZOJ A组】斐波那契

Description DJL为了避免成为一只咸鱼,来找czgj学习Fibonacci数列。 通过czgj的谆谆教导,DJL明白了Fibonacci数列是这样定义的: F(1)=1;F(2)=1;F(n)=F(n-1)+F(n-2)(n&gt;2) Czgj深谙熟能生巧的道理,于是他给了DJL一个数列,并安排了如下的训练计划: 1、“1 L r”,表示给ai 加上F(i-L+1) ,其中...

Brute♂force 675

AG16K MCU ARM Cortex M3

其中,Input文件为Keil生成的mcu程序文件,输出为合成后的存储格式Bin文件,Program address 为上方表格中“程序运行 RAM 地址(4bytes)”,即 Keil 中设置的程序运行地址。其中 MCU 程序的地址,根据 mcu.ip 中设置的 FLASH_BIAS 进行设置。AG16K MCU 的 FPGA 工程中,需调用 alta_mcu_m3 的硬核 IP,包含在 alta_sim.v 的库文。Quartus II。//MCU 程序在 FLASH 中存放的首地址。

Embeded_FPGA的博客 1815

jzoj4724. 斐波那契

Description DJL为了避免成为一只咸鱼,来找czgj学习Fibonacci数列。 通过czgj的谆谆教导,DJL明白了Fibonacci数列是这样定义的: F(1)=1;F(2)=1;F(n)=F(n-1)+F(n-2)(n&amp;gt;2) Czgj深谙熟能生巧的道理,于是他给了DJL一个数列,并安排了如下的训练计划: 1、“1 L r”,表示给ai 加上F(i-L+1) ,其中...

RainbowCrown_CGH's blog 679

使用qt+PaddleOCR做一个OCR软件demo

文章目录使用qt+PaddleOCR做一个OCR软件demo效果展示1 建立环境1.1 vs项目环境1.2 qtcreator项目环境1.2.1 源代码整理1.2.2 依赖项整理如下1.2.3 模型文件如下1.2.4 在.pro文件中设置依赖库的模式1.2.5 pro文件中添加.h和.lib2 在工程代码中添加截图功能2.1 新建截图类并连接信号2.2 QImage转cv::Mat3 在工程代码中集成PaddleOCR3.1 初始化PaddleOCR3.2 修改文字识别类的run函数,增加一个返回结果的值的

ShareProgress的博客 9313

Nacos启动报错No DataSource set?5分钟搞定standalone模式配置

本文针对Nacos启动时常见的“No DataSource set”报错,深入解析了其根源在于默认集群模式与外部数据库依赖。提供了两种快速解决方案:通过命令行参数“-m standalone”启动,或直接修改启动脚本配置文件,从而在5分钟内以单机模式成功启动Nacos,无需配置MySQL数据库。

weixin_29234509的博客 472

JZOJ4724. 【NOIP2016提高A组模拟8.21】

Description DJL为了避免成为一只咸鱼,来找czgj学习Fibonacci数列。 通过czgj的谆谆教导,DJL明白了Fibonacci数列是这样定义的: F(1)=1;F(2)=1;F(n)=F(n-1)+F(n-2)(n&gt;2) Czgj深谙熟能生巧的道理,于是他给了DJL一个数列,并安排了如下的训练计划: 1、“1 L r”,表示给ai 加上F(i-L+1) ,其中...

lijf2001的博客 470

CODESYS安装全攻略:从下载到配置的保姆级教程(含常见问题解决)

本文提供了一份详细的CODESYS安装与配置指南,涵盖从系统环境准备、安装包下载、Development System安装到Runtime System配置的全过程。教程重点解决了安装过程中的常见权限、兼容性和连接问题,并指导用户完成第一个PLC程序的创建与调试,帮助工业自动化开发者快速上手这一通用开发平台。

kkk56的博客 429

[平衡规划][模拟][前缀和] Jzoj P4724 斐波那契

Description DJL为了避免成为一只咸鱼,来找czgj学习Fibonacci数列。通过czgj的谆谆教导,DJL明白了Fibonacci数列是这样定义的:F(1)=1;F(2)=1;F(n)=F(n-1)+F(n-2)(n>2)Czgj深谙熟能生巧的道理,于是他给了DJL一个数列,并安排了如下的训练计划:1、“1 L r”,表示给ai 加上F(i-L+1) ,其中L<=...

weixin_30355437的博客 332

PHP实战:5分钟搞定SM4国密加密算法集成(附完整代码)

本文提供了一份可直接用于生产环境的PHP SM4国密加密算法集成实战指南。文章详细解析了SM4算法核心,对比了ECB与CBC工作模式,并给出了包含完整代码、密钥管理、数据填充及性能优化的解决方案,帮助开发者快速、安全地在PHP项目中集成国密加密算法。

2a4s6d8f0g的博客 346

人工智能AI在软件测试和质量效能中的实际应用

人工智能在软件测试中应用,介绍chatGPT在测试中的应用,还有多个AI驱动的测试工具。

lindafang72的博客 1万+

别再只盯着打靶了!从MS11-003漏洞出发,聊聊企业内网老旧系统的安全加固实战

本文从MS11-003漏洞出发,深入探讨企业内网老旧系统的安全加固实战方案。针对Windows 7等已终止支持的系统,提供漏洞检测、风险评估及多层级防护体系建设的具体方法,包括补丁管理策略、应用控制策略和网络层防护措施,帮助企业有效应对老旧系统安全挑战。

weixin_30372371的博客 537

数学史学习资料:史前数学

著名物理学家伽莫夫(宇宙大爆炸理论以及核聚变理论的提出者)在他的科普书《从1到无穷大》中举了这样一个例子。两个原始部落的酋长比赛,看谁说的数字大。第一个酋长说了三,第二个酋长想了半天,然后说你赢了。你今天听起来觉得这两个人真可笑,至少说出四,岂不就赢了?但是对这两位酋长来讲,所拥有的东西就很少超过三个,比三个多的东西他们就觉得没有必要数清楚了,就用许多来形容了。也就是说,他们生活的环境限制了他们的认知。

howard2005的专栏 905

JZOJ4724. 斐波那契

题目大意 定义Fi表示斐波那契数列的第i项。 给定一个长度为n的序列a,和m个操作。操作有两种: ′1 L R′修改操作,表示给ai,(L≤i≤R)加上F[i−L+1] ′2 L R′询问操作,表示询问∑Ri=Lai mod (1e9+9) Data Constraint n,m≤10^5

Akakii的博客 1011

智能化教育改革中的教师角色转变:AI应用架构师如何设计“人机协同”系统?

个性化与规模化的矛盾:如何用AI实现规模化的个性化学习,同时保留教师的“人文温度”?自动化与自主性的矛盾:如何用AI自动化流程(如批改),同时避免教师沦为“AI操作工人”?数据驱动与经验驱动的矛盾:如何平衡AI的“数据决策”与教师的“经验决策”,避免“算法偏见”或“经验固化”?在智能化教育改革中,教师始终是教育的核心——AI系统是“辅助工具”,而非“替代者”。

小白菜的博客 1273

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

【挖坑记】 JZOJ 4724 斐波那契

题目大意有一个斐波那契数列:F(1)=1;F(2)=1;F(n)=F(n-1)+F(n-2)(n>2); 也有一个序列长度为n的A; 还有两种操作: 1、“1 L r”,表示给ai 加上F(i-L+1) ,其中L<=i<=r ; 2、“2 L r”,表示询问 的值。n,m<=100000,a[i]<=1e9 时间限制4s 空间限制256M解题思路这题做得我满脑子都是尼克杨的问号,一定要写

baidu_34015648的博客 916

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

JZOJ #4724 斐波那契 (平衡规划实现根号算法)

题目描述: $F$表示斐波那契数列,给定原始数列,每次操作对$[l,r]$内的数加上$F[i-l+1](l\leq{i}\leq{r})$,或询问区间$[l,r]$的和。 解题思路: 我们发现对于修改操作可以$O(1)$实现。只要用一新数组$D$记录,对于$[l,r]$的修改,将$D[l]+=1,D[r+1]-=F[r-l+2],D[r+2]-=F[r-l+1]$,然后询问的时候令$D[i]...

weixin_30879833的博客 197

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

jzoj4724

DJL为了避免成为一只咸鱼,来找czgj学习Fibonacci数列。 通过czgj的谆谆教导,DJL明白了Fibonacci数列是这样定义的: F(1)=1;F(2)=1;F(n)=F(n-1)+F(n-2)(n>2) Czgj深谙熟能生巧的道理,于是他给了DJL一个数列,并安排了如下的训练计划: 1、“1 L r”,表示给ai 加上F...

weixin_30291791的博客 111

平衡规划(2021.08.26)

平衡规划后的华丽暴力——莫队算法 平衡规划后的华丽暴力——莫队算法_weixin_30588907的博客-CSDN博客 [平衡规划][模拟][前缀和] Jzoj P4724 斐波那契 [平衡规划][模拟][前缀和] Jzoj P4724 斐波那契_weixin_30355437的博客-CSDN博客 [JZOJ5951] 锋芒毕露 (【CodeChef June Challenge 2014】Sereja and Arcs)【平衡规划】【计数】【树状数组】 [JZOJ5951] 锋芒毕露 (

青少年趣味编程 464

Jzoj4627 斐波那契数列

题意:求Fib(n) 此题渗水,这里讲一种不用矩阵的方法 令f[n]=Fib(n) 我们假设k=n/2 那么久有以下递推式: 若n-k%2=1 f[n]=f[k]*f[k]+f[k+1]*f[k+1] 否则 f[n]=f[k]*f[k+1]+f[k+1]*(f[k]+f[k+1]) 边界特判一下就好了,复杂度lg n #include<stdio.h&g...

weixin_30606669的博客 107
上一篇: Jzoj4722 跳楼机
下一篇: Jzoj4725 素数序列
扩展的灰
博客等级 码龄12年 60粉丝 342原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址