UVa:10229 Modular Fibonacci

Omnibox 2.11 NAS部署指南:家庭影音中枢的轻量化落地实践 家庭影音平台本质是本地化内容调度中枢,其核心在于聚合NAS媒体库、统一管理直播/IPTV/音频/视频等多源内容,并通过智能元数据匹配与硬解加速实现零门槛播放体验。技术原理上依赖Java轻量Web容器(Jetty)、SQLite嵌入式数据库双缓存架构,以及宿主机FFmpeg动态链接与HTTP/2直播代理治理能力。该方案显著降低4K播放卡顿、EPG加载失败、海报缺失等高频问题,适用于群晖、飞牛、绿联等主流NAS设备,尤其适配ARM64芯片与Realtek网卡等国产硬件生态。本文聚焦Omnibox 2.11在真实 阅读详情

本来以为要用矩阵,结果在网上无意中看到斐波那契数列的另一个通项公式,于是写了一个,试了最大数据,果断超时,然后加了个记忆化,然后就AC了。。

贴吧上看到的。

Fibonacci数是组合数学中非常重要的一个数列,它的递推公式是:
  F(1)=F(2)=1
  F(n)=F(n-1)+F(n-2)
  当然,用这个公式来计算F(n)是非常慢的,当计算F(n)时需要从F(1)一直计算到F(n)。Fibonacci数列还满足一些其他的公式,如:
  F(a+b+1)=F(a+1)*F(b+1)+F(a)*F(b)
  利用这个公式,可以加速Fibonacci数的计算。我们考虑同时计算F(2n+1)和F(2n),则按照上面的公式:
  F(2n+1)=F(n+1)*F(n+1)+F(n)*F(n)
  F(2n)=F(n+1)*F(n)+F(n)*F(n-1)=F(n+1)*F(n)+F(n)*(F(n+1)-F(n))
  这样,F(2n+1)和F(2n)的计算变为了F(n+1)和F(n)的计算,即下标变为了原来的一半。重复利用这种方法,可以每次让下标变为原来的一半,总共需要大约log n次计算(以2为底)。
  当n较大时,后面的方法就比直接的递推要快得多,比如当n=1000000时,后面的方法大概需要20次计算,而直接递推的方法大概需要1000000次计算

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#define ll long long
#define INF 2139062143
#define MAXN 1005
using namespace std;
int mod[25];
int MOD;
map<ll ,int > key;
ll fib(ll val)
{
    if(val==1) return 1;
    if(val==0) return 0;
    if(val==2) return 1;
    if(key[val]) return key[val];
    if(val%2)
    {
        ll a=fib(val/2+1)%MOD,b=fib(val/2)%MOD;
        return key[val]=(a*a%MOD+b*b%MOD)%MOD;
    }
    else
    {
        ll a=fib(val/2+1)%MOD,b=fib(val/2)%MOD,c=fib(val/2-1)%MOD;
        return key[val]=(a*b%MOD+b*c%MOD)%MOD;
    }
}
int main()
{
    for(int i=0; i<=22; ++i) mod[i]=pow(2.0,i);
    int n,m;
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        key.clear();
        MOD=mod[m];
        printf("%lld\n",fib(n));
    }
    return 0;
}


 

STM32开发者必看:如何在正点原子探索者开发板上快速移植CANopenNode协议栈 本文为STM32开发者提供了在正点原子探索者开发板上快速移植CANopenNode协议栈的实战指南。文章详细介绍了从环境准备、硬件抽象层适配到协议栈初始化与测试的全过程,并分享了PDO配置与性能优化等关键技巧,帮助开发者高效实现CANopen标准化通信。 阅读详情

相关推荐

大模型KV Cache节省神器MLA学习笔记(包含推理时的矩阵吸收分析)

这篇文章主要是对Deepseek2提出的优化KV Cache的MLA方法做个人理解,特别是关于MLA的矩阵吸收部分,这部分Paper以及官方开源实现没有给出。然后,开源社区大佬确实出手很快,在知乎的《如何看待 DeepSeek 发布的 MoE 大模型 DeepSeek-V2?

I good vegetable a! 1万+

uva 10229 - Modular Fibonacci

考虑到出现出现取模,打印了几组数据发现有循环节长度为3*(1 #include #include using namespace std; int fib[2000000]; int main() { int m,n; while(scanf("%d%d",&n,&m)==2) { if(!m) printf("0\n");

Just for you 703

《解锁GCC版本选择的奥秘:从入门到精通》

GCC 版本的选择是一项复杂而关键的决策,犹如一场精心策划的战略布局,贯穿于软件开发的整个生命周期。从项目需求与兼容性的深度考量,到性能与稳定性的权衡抉择,再到硬件与系统适配的精准对接,每一个环节都紧密相连,相互影响。在游戏开发行业,对性能的极致追求促使开发者青睐较新的 GCC 版本,以实现更流畅的游戏体验和更震撼的视觉效果;科学计算领域则依赖于 GCC 版本对复杂数学运算的高效优化,以应对大规模数据处理的挑战;嵌入式开发行业因硬件资源的限制和对稳定性的严苛要求,通常选择经过长期验证的稳定版本;

zheng_ruiguo的专栏 1430

UVA - 10229 - Modular Fibonacci (矩阵快速幂 + fibonacci)

题目传送:UVA - 10229 思路:就是简单的矩阵快速幂求fibonacci数列,然后注意可能中间结果会爆int,因为2^19有50多万 AC代码: #include #include #include #include #include #include #include #include #include #include #include

Never say never 1196

(超全面,超基础)Kriging插值推导理论笔记,算法,普通克里金

最近老师让我再重新推导一下克里金插值的方法如何求出预测结果,于是我又无数次地打开了大神的推导原理过程链接????:克里金(Kriging)插值的原理与公式推导 作者:xg1990,但是不可避免地在推导过程中,数学知识基础薄弱的我卡住在一些公式推导的步骤中。 所以就想基于上面大神的推导过程,将里面的推导写得更具体些,当然觉得毫不吃力可以进行推导的大神们可以不看我的注释,直接点开链接看就好。 我看到csdn中很多关于克里金推导的博客里面的内容直接截屏或者复制了上面链接里大神发表的内容,也不注

Olivel1997的博客 1万+

如何实现chrome谷歌浏览器多开(独立环境 独立cookie)

由于各种各样的原因,你可能需要在一个电脑登录某个平台,比如一个电脑登录3个公众号,或者3个知乎等等。最简单的方案是,直接安装3个不同的浏览器,比如一个谷歌浏览器,一个火狐浏览器,一个 Edge 浏览器。这个方案也能解决,但如果想多开10个呢?安装10个不同的浏览器也能解决,但感觉这样比较复杂,另外一方面安装太多的应用,会导致电脑卡顿。这里给大家介绍,我在 Win 和 Mac 系统下的躲开解决方案。Win 系统下的解决方案最为简单,原理就是给不同的谷歌浏览器,指向不同的用户存储路径即可。

lzqial1987的专栏 1万+

uva 10229 - Modular Fibonacci(矩阵快速幂)

题目链接:uva 10229 - Modular Fibonacci 题目大意:给出n和m,求出f(n) %m, f(x)为斐波那契数列。 解题思路:因为n的范围在0~214783647,所以计算量比较大,所以用矩阵快速幂。 {(1, 1), (1, 0)} ^ n *(f[1], f[0]) = (f[n], f[n - 1]). #include #inc

不慌不忙、不急不躁 2939

屏幕暗斑、彩带、摩尔纹?别急着报废!聊聊工厂里那个‘救火队长’Demura到底能干啥

本文深入探讨了Demura技术在屏幕制造中的应用,详细解析了如何通过Demura系统修复亮度型Mura缺陷,如暗斑、亮斑等,并提供了产线快速诊断流程和设备配置建议。文章还通过实战案例分析了Demura的有效性和局限性,帮助工程师在分秒必争的生产线上做出明智决策。

weixin_30565327的博客 341

UVA 10229 Modular Fibonacci

UVA_10229     将斐波那契数用矩阵形式表示,然后再做快速幂取模即可。 #include&lt;stdio.h&gt;#include&lt;string.h&gt;#define MAXD 50long long int N, M, D, a[MAXD][4], b[4];void pow_mod(long long int n, int e){ if(n == 1) ...

weixin_33994429的博客 93

YOLOv8改进策略【卷积层】| DEConv: 强度信息与梯度特征融合的细节增强 适用于小目标与细节目标检测任务

本文记录的是利用 模块优化 的目标检测网络模型。(Detail-Enhanced Convolution,细节增强卷积)的设计旨在,解决 目标检测网络中传统普通卷积缺乏目标细节相关先验、对小目标边缘、目标与背景边界等关键细节捕捉能力不足的问题,同时避免引入额外参数量与计算开销,以适配 对实时推理性能与检测精度的双重需求。DEA-Net: Single image dehazing based on detail-enhanced convolution and content-guided atte

Limiiiing的博客 354

Allegro快速编辑丝印文字操作指导

选择setup-Application Mode-placement edit。Allegro支持丝印文字的编辑,下面介绍快速编辑丝印文字的两种方法如下。这个功能还支持拷贝粘贴,可以从其它地方拷贝过来,免去了书写的麻烦。出现text edit窗口,输入自己需要的文字,点击ok。鼠标移动到丝印文字位置,文字会被高亮起来。Allegro快速编辑丝印文字操作指导。点击丝印文字,丝印会被高亮起来。选择Text edit 命令。输入需要更改后的文字,如下。右击选择text edit。以编辑下方丝印文字为例。

weixin_54787054的博客 4195

UVA10229 Modular Fibonacci 【循环数列】

The Fibonacci numbers (0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, ...) are defined by the recurrence:    F0 = 0    F1 = 1    Fi = Fi−1 + Fi−2 for i &gt; 1Write a program which calculates Mn = Fn mod 2^m for...

海岛Blog 896

如何使用手机编程查看妻子的微信

在本文中,我将向您介绍如何使用编程技巧来查看妻子的微信消息。请注意,隐私是非常重要的,因此在进行此类操作之前,请确保您已经获得了妻子的明确许可。此外,请记住,未经对方授权访问他人的通信是违法行为,因此请谨慎行事。请记住,这仅仅是使用编程技巧来查看妻子的微信消息的一种方法。itchat是一个用于微信个人账号的API,可以通过Python编程语言与微信进行交互。一旦我们登录成功,我们可以使用itchat库获取妻子的微信好友列表。我们可以使用itchat库来查看妻子的微信消息。步骤 5:查看妻子的微信消息。

TechPulseZ的博客 477

UVa 10229 - Modular Fibonacci

题目:求第n个Fib数与2^m的模。 分析:分治,快速幂。             具体参照本人的 斐波那契数列(http://blog.csdn.net/mobius_strip/article/details/8222309)             中 4.Fib的计算3:分治法;             设Jn为第n个月有生育能力的兔子数量,An为这一月份的兔子数量。得到如下递推矩

小白菜又菜 1515

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

uva 10229 Modular Fibonacci

uva 10229 Modular Fibonacci

@fei 716

Camera2Demo

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

UVA10229Modular Fibonacci(矩阵快速幂)

UVA10229Modular Fibonacci(矩阵快速幂) 题目链接 题目大意:给你i和m,求Mi, Mi = (F(i - 1) + F(i - 2)) % 2^m; 解题思路:因为Mi = (F(i - 1) % 2^m + F(i - 2)% 2^m) % 2^m = (M(i - 1) + M(i - 2)) % 2^m.类似于求fibonacci数加上取模,只是n

763

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

UVa 10229 Modular Fibonacci

背景:斐波那契数列,求Fib[n] mod 2m 思想:分治法的应用,构造矩阵 code //12ms 2010-05-14 22:00:33//Type: 二分法求幂,Fibonacci (矩阵乘法加速)#include <stdio.h>#include <string.h>int main(){ int n, m; int bi[2...

weixin_34202952的博客 122

UVa10229 - Modular Fibonacci

Problem A: Modular Fibonacci The Fibonacci numbers (0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, ...) are defined by the recurrence: F0 = 0 F1 = 1 Fi = Fi-1 + Fi-2 for i>1 Write a program which c

mowayao的专栏 934

UVa 10229 - Modular Fibonacci(数论,规律)

DC翻出以前做的好多题,其中这个题让DC纠结了一段时间,因为乍眼一看没有任何思路,看代码也没什么想法,然后在纸上算了算,突然想起以前的计算过程,然后豁然开朗 DC总结的规律:fib数列对2^m取模的循环节为3*(2^(m-1)) #include using namespace std; int fib[22][2000000]; int main() { int m,n;

DC的ACM奋斗史 1152

UVA - 10229 Modular Fibonacci

题意:矩阵快速幂取模 #include #include #include #include using namespace std; long long mod; long long p[]={1,1,1,0}; void matrix(long long a[],long long b[],long long c[]){ long long q = a[0]*b[0]

那些年 829

uva 10229 Modular Fibonacci(矩阵快速幂求斐波那契数列 or 找规律)

【例题】 uva 10229 Modular Fibonacci 矩阵快速幂求斐波那契数列板子题。 规律:fib数列对2^m取模的循环节为3*(2^(m-1)). 【代码一】 #include<bits/stdc++.h> using namespace std; int fib[22][2000000]; int main() { int m,n; for...

菜鸡成长史 357

Modular Fibonacci UVA - 10229(斐波那契数列、矩阵快速幂)

题目链接:Modular Fibonacci UVA - 10229 题目大意:输入n与m,输出f[n]%m。f[n]为斐波那契数列里的第n个数。 n比较大,可以借助矩阵快速幂来求斐波那契数列的第n项。 #include <iostream> #include <cstring> #include <cstdio> using namespace std; ...

Ai_Mijie的博客 320

UVa 10229 Modular Fibonacci (矩阵快速幂求斐波那契)

10229 - Modular Fibonacci Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=115&page=show_problem&problem=1170 The Fibonacci numbers (0, 1,

AC,∑ndless 1649

UVA 10229 Modular Fibonacci (矩阵乘法+快速幂)

题目:http://uva.onlinejudge.org/external/102/10229.pdf 题意:给你n和m,求出Fibonacci数列的第n项F(n)模2^m。 分析:由于n 代码: #include #include #include using namespace std; struct Matrax { long long mat[2][2]; }U,F;

w20810的专栏 561
上一篇: UVa:1393 Highways
下一篇: UVa:10747 Maximum Subsequence
亚N程
博客等级 码龄16年 18粉丝 392原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值