NOJ 1175 Dress, Left Dress!

Matlab实现使用遗传算法的混合能源系统优化.rar 立即下载
链接地址:http://ac.nbutoj.com/Problem/view.xhtml?id=1175
一些士兵站在一直线上,当每一个人都向左看时,看到的第一个比自己高的那个人就是the first man。并输出the first man的位置,若不存在the first man,输出-1。将所有身高存在一数组里,然后遍历一遍,但是这样会超时!所以,必须要优化算法。
这些身高中,如果一人的身高比左边的某个人和右边的某个人都低或存在相等(这里的左边和右边不是指相邻的),那么这个人的身高是不需要在后面出现的,也就是要剔除这个人的身高。
第一种方法:用栈。
我用的是另一种方法,取两个数组 height [ ] , position [ ] 。height存放身高,position存放


以下是我AC的代码:
#include <iostream>
#include <cstdio>
using namespace std;

int height[1000100];
int position[1000100];

int main()
{
int a,n,p;

while (~scanf("%d", &n))
{
p = 0;
for (int i = 0; i < n; i++)
{
scanf("%d", &a);
while (p > 0)
{
if (height[p-1] <= a) p--;
else break;
}
if (i > 0) printf(" ");
if (p > 0) printf("%d", position[p-1]);
else printf("-1");
position[p] = i;
height[p++] = a;
}
printf("\n");
}

return 0;
}


基于斜坡补偿的Buck电路峰值电流+电压电流双闭环控制【附说明文档】(Simulink仿真实现)优快云首页发布文章优快云同步助手LLC谐振变换器开环+闭环软启动仿真设计(Simulink 内容概要:本文围绕三电平VIENNA整流器的双闭环控制与中点电位平衡问题展开仿真研究,提出了一种基于上下电容电压差值补偿的中点电位平衡策略。该策略在传统电压电流双闭环PI控制的基础上,引入电容电压差值作为反馈信号,通过SVPWM调制中冗余小矢量的时间分配实现中点电荷的定向调节,从而在不改变主控制结构的前提下有效抑制中点电位偏差。仿真结果表明,该方法不仅确保直流母线电压稳定跟踪800V给定值,还能显著提升上下电容电压的均衡度,同时保持输入电流低谐波水平,验证了控制策略的可行性和有效性。; 适合人群:电力电子、电气自动化及相关专业的研究生、科研人员及工程技术人员,具备一定的MATLAB/Simulink仿真基础和电力电子拓扑知识背景者更佳。; 使用场景及目标:①掌握三电平VIENNA整流器的工作原理与中点电位波动的成因;②理解电压电流双闭环PI控制的设计要点与参数整定原则;③学习基于差值补偿的中点电位平衡控制策略及其与SVPWM的协同机制;④应用于充电桩、航空电源、通信电源等中大功率单向整流场合的控制系统设计与优化。; 阅读建议:建议结合文中提供的仿真模型与参数设置进行动手实践,重点关注中点电位平衡投入前后电容电压波形的变化,对比分析不同工况下的系统动态响应,深入理解控制策略的作用机理。同时可进一步探索在电网不平衡、轻载等复杂工况下的控制性能,以拓展应用场景。 立即下载

相关推荐

自适应多机器人编队规划,以包围和跟踪具有运动和可见性约束的目标(Matlab代码实现)

内容概要:本文针对“自适应多机器人编队规划,以包围和跟踪具有运动和可见性约束的目标”开展研究,提出一种基于Matlab的仿真方法,实现多机器人在动态环境中对移动目标的协同包围与持续跟踪。该方法综合考虑了机器人的运动学约束与传感器的视线(visibility)限制,设计了分布式控制策略与自适应编队算法,能够在复杂环境下有效维持编队结构的稳定性和任务执行的鲁棒性。研究详细阐述了系统建模过程、控制律设计原理、编队形成与保持机制,并通过Matlab代码实现了完整的仿真验证,展示了算法在不同动态场景下的适应能力与性能优势; 适合人群:具备机器人学、自动控制理论、多智能体系统等相关基础知识,熟悉Matlab编程语言,从事智能系统、协同控制、路径规划与自主导航等方向的研究生、科研人员及工程技术人员; 使用场景及目标:①应用于安防监控、环境探测、灾害救援等场景中的多机器人目标围捕与跟踪任务;②为多智能体协同控制、分布式编队保持、避障与可见性维护等关键技术提供可复现的算法框架与仿真平台;③辅助高校与科研机构在相关领域的教学演示与科研创新,深化对自适应控制与分布式协同机制的理解; 阅读建议:建议读者结合提供的Matlab代码逐模块分析其实现逻辑,重点关注控制律设计、约束处理与自适应机制部分,可通过调整机器人数量、目标轨迹、传感器参数等进行扩展性实验,以深入掌握多机器人协同系统的动态行为与优化方法。

NOJ [1175] Dress, Left Dress!

问题描述Maybe you think this problem is about girls and ladies.But you're wrong. 'Left dress' means 'Eyes left'. It's used in armed forces. It will make a square more orderly.Now several soldiers stand in

Alex 519

写给小白的“具身智能”入门科普

智能”,大家都懂,也就是AI。那么,什么是“具身”?“具身”是一个很小众的名词,通常都出现在哲学、认知科学领域。它的英文叫Embodied,是embody的过去式和过去分词。em-表示“进入,使……”,-body表示“身体”。组合起来,就是“使……进入身体”。Embodied Intelligence(具身智能),顾名思义,就是“使智能进入身体”、“给智能一个身体”的意思。那么,具身智能,是不是就是“AI+身体”呢?这样说并不准确。

欢迎来到我的博客 1826

NOJ1175---Dress, Left Dress!(单调栈)

Maybe you think this problem is about girls and ladies. But you’re wrong. ‘Left dress’ means ‘Eyes left’. It’s used in armed forces. It will make a square more orderly. Now several soldiers stand in

Alex 825

Windows 10/11下R与RStudio最新版安装避坑指南(含镜像加速配置)

本文提供了Windows 10/11系统下R与RStudio最新版的详细安装指南,包含镜像加速配置和常见问题解决方案。通过分步教程帮助用户避开安装陷阱,优化开发环境设置,特别适合国内用户快速搭建高效的数据分析平台。

weixin_29065959的博客 1009

Cadence Sigrity PowerDC实战:如何用PCB电热混合仿真解决散热难题(附详细配置步骤)

本文详细介绍了如何利用Cadence Sigrity PowerDC进行PCB电热混合仿真,以解决高功率密度设计中的散热难题。文章通过解析电热耦合原理,并附上详细的配置步骤与实战技巧,指导硬件工程师同步优化电气性能与热管理,从而在设计源头提升产品可靠性与效率。

weixin_29292535的博客 199

ACM第K大数——双二分

数组A和数组B,里面都有n个整数。数组C共有n^2个整数,分别是A[0] * B[0],A[0] * B[1] ......A[1] * B[0],A[1] * B[1]......A[n - 1] * B[n - 1](数组A同数组B的组合)。求数组C中第K大的数。

ColorWaterer的专栏 1716

MounRiver Studio实战:像管理个人项目一样整理沁恒MCU的EVT例程(附文件结构图)

本文详细介绍了如何使用MounRiver Studio重构沁恒MCU的EVT例程,实现工程化管理。通过分析官方EVT设计的局限性,提出标准化的目录结构和迁移步骤,帮助开发者提升代码可维护性和团队协作效率。文章还提供了MounRiver Studio的关键配置参数和常见问题排查指南,适用于沁恒MCU开发者。

weixin_33940469的博客 357

ACM投票——二分法

问题描述 有N个城市,每个城市有Ai个人。 现在要开始投票,每个人有一张票。 作为领导者,你有B个箱子,你必须要将这B个箱子分发到N个城市去,每个城市至少需要一个箱子。 每个人都必须要投票,不能弃票,也就是说要把票丢进箱子里去(每个城市有Ai张票)。

ColorWaterer的专栏 1576

使用 MATLAB/Simulink 构建一个基于FOC控制的PMSM矢量控制仿真模型

本教程详细介绍了基于MATLAB/Simulink的永磁同步电机(PMSM)磁场定向控制(FOC)系统建模与仿真方法。主要内容包括:PMSM电机模型参数设置、Clarke/Park变换模块设计、电流环PID控制器配置、SVPWM调制实现以及系统仿真参数优化。文章提供了模块化设计思路和具体参数设置示例,并给出了PID整定建议和进阶优化方向。通过该仿真模型,可深入理解PMSM矢量控制原理,掌握高性能电机控制系统的建模技巧,适用于伺服系统、电动汽车驱动等高端控制场景。教程还推荐了实时仿真和高级控制策略等扩展应用。

xiaoheshang_123的博客 530

金融数字化——详解2025年金融智能体深度应用报告【附全文阅读】

《2025年金融智能体深度应用报告》显示,金融智能体已实现80%部署率,推动行业效率提升30%-50%。报告指出智能体通过"感知-推理-规划-执行-进化"机制突破大模型局限,在风控、客服、投研等100+场景实现自动化。典型案例显示,工商银行信贷审批效率提升60%,蚂蚁数科智能客服解决80%问题。尽管面临系统协同、标准缺失等挑战,未来趋势将向多模态交互、自主进化和ESG投资等方向拓展。

cdfunlove的博客 207

NOJ [1314] Brave Sword

链接地址:http://ac.nbutoj.com/Problem/view.xhtml?id=1314是不是想起了筷子大作战这一题?(1) 那题的意思就是有很多筷子,除了其中一只,其他都是成对等长出现的。直接异或,所有相同的数都会被抵消(异或运算中,相同位置值相等的结果为0,就是说所有成对出现的都会最终成为0),最后的结果自然是那个落单的数了。然后,我们来看这题。(2) 这题的意思是有很多把钥匙

ColorWaterer的专栏 944

物流分拣YOLO实战:YOLO26 OBB+YOLOv8多尺度融合,不规则包裹分拣效率提升40%(附训练+部署代码)

在物流分拣的工业场景中,模型的检测精度、推理速度、部署友好性本次基于YOLO26 OBB+YOLOv8多尺度融合打造的物流分拣视觉检测方案,精准解决了工业场景中不规则包裹的旋转检测、多尺度包裹的漏检问题,最终实现分拣效率提升40%,检测准确率提升至95%以上,且模型在边缘设备上的推理帧率稳定35FPS+,完全适配物流分拣的工业落地需求。

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 882

ACM 寻找众多情侣堆中的两个基佬

这题的意思是有很多情侣,每对情侣手握的牌号是一样的,然后在这群人中,有两个人是搞基的,他们手里握的牌子是不一样的,请找出这两个人,并从小到大输出他们的牌号。

ColorWaterer的专栏 794

《2026国赛命题趋势前瞻:从近年真题看今年高教社杯的三大热点方向》

距离2026年“高教社杯”全国大学生数学建模竞赛,只剩下不到一个月的时间。如果你还在盲目刷往年真题,如果你还在死磕传统的微分方程和线性规划,如果你还在用五年前的论文模板——那么很遗憾,你很可能已经在起跑线上落后了。这不是危言耸听。过去三年,国赛的命题风格发生了肉眼可见的剧变。国赛正在从“数学技巧比拼”全面转向“数据科学能力+工程落地思维”的综合较量。2026年,恰逢国赛创办第35周年。在这个特殊的节点,命题会走向何方?哪些方向会大概率成为今年的“爆点”?

YOLO 25

pscad IEEE标准系统搭建说明

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

NOJ [1313] Anger Begins

链接地址:http://ac.nbutoj.com/Problem/view.xhtml?id=1313线段相交 + 并查集线段斜率可以是0也可以是无穷大。只要有一条路的一个点在另一条路上就算连通。将连通的路并在一起,然后直接就可以判断了。出题代码:#include #include #include #include #include #include #include #include #in

ColorWaterer的专栏 676

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

NOJ [1201] Chihuo II - Eating in China

链接地址:http://ac.nbutoj.com/Problem/view.xhtml?id=1201这题其实不难,总归算法就是凸包加水DP。但是我一直RA,以为是凸包码错了,还新学了一个凸包的算法,发现又错了,最后才知道是忘了初始化。题目意思很容易理解,就是洛天依去中国吃好吃的,然后经过了N个地方,每个地方都有坐标x和y表示。洛天依游走的方法是独特的,她一定要先在最外面一圈的点找一个点开始出发

ColorWaterer的专栏 650

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

NOJ 1002 将军问题

连接地址: http://ac.nbutoj.com/Problem/view.xhtml?id=1002 在做此题之前,你首先要知道中国象棋的游戏规则吧,不知道的看说明书去。 问题很简单,就是让你判断当时的局面是否存在将军状态。 首先,我们先想想,可以产生将军的棋子是哪些? 兵提步,判断将帅周围的三格是否有对方的兵。 炮跳轰,判断将帅所在的两条坐标线上是否有对方的炮,且将帅与炮中间必须

ColorWaterer的专栏 636

HDU 1405 坑爹的The Last Practice

链接地址:http://acm.hdu.edu.cn/showproblem.php?pid=1405此题真坑!!!题意很容易就能看懂,坑爹的地方就在“每个数字后都有一个空格,包括最后一个数字”。以下是我AC的代码:#include #include #include #include #include #include #include #include #include #include #i

ColorWaterer的专栏 633

杭电 1212 Big Number

链接地址:http://acm.hdu.edu.cn/showproblem.php?pid=1212以下是我AC的代码。#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;#d

ColorWaterer的专栏 611

NOJ [1016] 缙云烧饼

链接地址:http://ac.nbutoj.com/Problem/view.xhtml?id=1016突然发现自己刚进入ACM队时写的一个代码,现在还是觉得好好笑,翻出来晒晒。#include using namespace std;#define N 1000char a[N][N];int main(){    int n,m,i,j,s;    while (scanf("%d",&n)!

ColorWaterer的专栏 611

NOJ [1318] First Choice

链接地址:http://ac.nbutoj.com/Problem/view.xhtml?id=1318此题就是一个欧拉回路。将每一个房间都理解为一个点,然后门就是房间间的连接条件,门的个数就是该点的度,只要所有点的度出现奇数的次数小于3就表示可以走完所有的连接且不重复。那么还有一个条件就是先判断此图是否是完全连通的。DFS一下就可以了。出题代码:#include #include #includ

ColorWaterer的专栏 578

NOJ [1319] Go Through

链接地址:http://ac.nbutoj.com/Problem/view.xhtml?id=1319此题的意思就是,Wodex和他的一个伙伴要经过所有的圆盘(点),他们所走的距离要在M内,所以肯定要求最短路。起先他们可以各自选择一个点作为起始点,然后开始走。然后走的方式是这样的,走过最外面一圈的任意一点的那个人就不能走除最外面那些点以外的点(我们称这些点为内点好了)了,而且Wodex的伙伴因为

ColorWaterer的专栏 573

HDU 1202 The calculation of GPA

链接地址:http://acm.hdu.edu.cn/showproblem.php?pid=1202此题非常好理解,代码也很好敲,但是有很多坑。首先,学分和分数都是double型的(分数可以大于100,更可以小于0)=  =其次,分数为-1的,算缺考(但是如果所有科目都是缺考的话,要输出-1、下面是我AC的代码:#include #include #include #include #inclu

ColorWaterer的专栏 570

NOJ [1321] I am You

链接地址:http://ac.nbutoj.com/Problem/view.xhtml?id=1321给你一个N,让你找到最小的M使得(2 ^ N - 1) % (2 ^ M - 1) = 0。2 ^ N的二进制数一定是1后面跟随一些0,那么2 ^ N - 1的二进制数每一位上都是1了,所以要想使(2 ^ N - 1) % (2 ^ M - 1) = 0, 那么其实只要使2 ^ N - 1的二进

ColorWaterer的专栏 550
上一篇: HDU 1003 Max Sum
下一篇: NOJ [1173] Birdlike Angry Pig
ColorWaterer
博客等级 码龄12年 16粉丝 128原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值