HDU 5288 OO’s Sequence

unitree-G1外接 USB 麦克风完整配置指南 首先,将type-c麦克风插入G1机器人的USB口后,记录下USB麦克风的卡号(card)和设备号(device),通常显示为 card 1: Device [USB Audio Device] 阅读详情

分析:题意是给你n个数字,全部区间[i,j](1<=i<=n,i<=j<=n)内满足一个数与区间中的其他数互质的数有多少个。定义两个一维数组l,r,l[i]和r[i]表示第i个数左侧和右侧最接近a[i]的且是a[i]的因子的数的位置,那么a[i]在区间(x,y)(l[i]<x<=i,i<=y<r[i])内均满足和区间内的其他元素互质,所以a[i]能贡献的答案是(i-l[i])*(r[i]-i)。

# include <stdio.h>
# include <string.h>
# define mod 1000000007
# define MAX(x,y) ((x)>(y))?(x):(y)
# define MIN(x,y) ((x)<(y))?(x):(y)
  int a[100005],l[100005],r[100005],mark[100005];
  int main()
  {
      int i,j,n,tmp;
      __int64 a1,a2,sum;
      while(scanf("%d",&n)!=EOF)
      {
          for(i=1;i<=n;i++)
          {
              l[i]=0;
              r[i]=n+1;
              scanf("%d",&a[i]);
          }
          memset(mark,0,sizeof(mark));
          for(i=1;i<=n;i++)//a[1]~a[n]寻找a[i]的l[i]值,
          {
              for(j=1;j*j<=a[i];j++)//枚举a[i]的因子
              {
                  if(a[i]%j)
                    continue;
                  if(mark[j])//j为a[i]的因子,判断a[i]的左侧有没有j
                    l[i]=MAX(l[i],mark[j]);
                  if(mark[a[i]/j])//同样a[i]/j也为a[i]的因子
                    l[i]=MAX(l[i],mark[a[i]/j]);
              }
              mark[a[i]]=i;//每次查找完标记a[i]的位置
          }
          memset(mark,0,sizeof(mark));
          for(i=n;i>=1;i--)//查找r[i]
          {
              for(j=1;j*j<=a[i];j++)
              {
                  if(a[i]%j)
                    continue;
                  if(mark[j])
                    r[i]=MIN(r[i],mark[j]);
                  if(mark[a[i]/j])
                    r[i]=MIN(r[i],mark[a[i]/j]);
              }
              mark[a[i]]=i;
          }
          for(i=1,sum=0;i<=n;i++)
          {
              a1=i-l[i];
              a2=r[i]-i;
              sum=(sum+a1*a2)%mod;
          }
         printf("%I64d\n",sum);
      }
      return 0;
  }


斑鬣狗优化算法(SHO)详解:从生物原理到代码实战 斑鬣狗优化算法(SHO)是一种新型元启发式优化算法,灵感来源于斑鬣狗的群体狩猎行为。该算法通过模拟斑鬣狗的包围猎物、协同狩猎和攻击猎物等生物行为,将优化问题转化为智能搜索过程。SHO算法包含探索与开发两个阶段,通过数学模型实现群体协作和自适应平衡,具有参数简单、收敛快等优势。文章系统介绍了SHO的生物基础、数学模型、实现方法(包括MATLAB和Python代码)、改进策略以及在函数优化、路径规划等领域的应用案例,最后讨论了算法的优势、局限性和未来研究方向。 阅读详情

相关推荐

Django 小实例S1 简易学生选课管理系统 —— 〇、初步介绍与演示

python Django实现的一个简易的教务选课系统。 介绍与演示的视频版本已发到我的b站: https://www.bilibili.com/video/BV1er4y1w7ty。 项目已上传到我的github: https://github.com/BigShuang/SimpleStudentCourseManagementSystem。 S1总目录: 〇、初步介绍与演示 一、项目流程梳理与数据库设计 ======================= 大爽歌作,made by big shuang.

大爽老师的博客 5944

Godot 4.x运动匹配实战:告别动画状态机,实现3D角色自然移动

在3D游戏角色动画领域,动画状态机(State Machine)和动画混合(Blending)是传统且广泛使用的技术方案,它们通过预设状态和过渡规则来控制角色动作。其核心原理是开发者手动定义所有可能的动画片段及切换条件,通过线性插值实现平滑过渡。然而,这种方法在面对复杂、连续的移动需求(如八向移动、快速转向)时,往往需要搭建庞大的状态网络,且难以覆盖所有可能的玩家操作组合,容易导致动画断裂或脚底打滑。运动匹配(Motion Matching)作为一种数据驱动的动画生成技术,为解决这一痛点提供了新思路。它通过

weixin_30664615的博客 402

HI3516CV610海思SOC:超高清智慧视觉开发全攻略

本文全面解析海思HI3516CV610 SOC在超高清智慧视觉开发中的应用。该芯片集成双核A7处理器、1Tops NPU、AI ISP及4K视频编码器,专为智能摄像头设计。文章详细介绍了开发环境搭建、核心硬件架构、媒体处理平台(MPP)实战、AI算法集成与系统调优等全流程攻略,帮助开发者高效构建稳定可靠的视觉AI产品。

weixin_29269441的博客 1252

HDU 2611 Sequence Two dfs

#include &lt;cstdio&gt; #include &lt;cstring&gt; #include &lt;algorithm&gt; using namespace std; int n,p; int cnt,len; struct node{ int pos,val; }a[105]; int res[105]; //用来记录当前生成的路径 bool cmp(no...

weixin_42246923的博客 190

自回归分布滞后模型 (ARDL)及 Stata 具体操作步骤

例如,Bahmani-Oskooee 和 Brooks(1999)研究了汇率波动与贸易收支之间的关系,发现汇率的变动在长期和短期内对贸易收支的影响存在差异,ARDL 模型能够有效地捕捉这种复杂的关系。它结合了自回归(Autoregressive,AR)模型和分布滞后(Distributed Lag,DL)模型的特点,能够同时考察变量之间的短期和长期关系。假设我们收集了一段时间内的居民消费和可支配收入数据,通过对这些数据进行分析和估计,可以得到模型的参数估计值,从而揭示消费与收入之间的短期和长期关系。

a519573917的博客 6093

面向 ABAP 开发者的 Joule 实战:把 AI 带进 Eclipse 的每一次敲键

本文介绍了SAP推出的ABAP开发AI工具套件Joule for developers,重点解析了其代码补全、自然语言对话、代码解释、测试生成等功能如何融入ABAP Cloud开发全流程。文章提供了具体的使用场景和操作示例,包括RAP应用开发中的建模辅助、代码理解、测试生成等环节,并分享了实用的提示词模板。同时强调了启用授权等实施细节,帮助开发者将AI能力转化为实际生产力而非演示效果。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 460

HDU 2611 Sequence two

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2611 Sequence two Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 532    Accepted Submissio

哇哈哈的专栏 567

CKS-CN考试之路----11

显然是alpine-b的镜像有libcrypto3-3.1.4-r5。新版本发布老版本会被回收,此时pod只剩下2个container。我们依次测试是哪个镜像里包含libcrypto3。可以看到alpine的pod有3个副本.

Q先生 652

Sequence two(hdu2611dfs)

题意:同2610一样,但是最后的输出序列要是有序的 思路:dfs,你原序列是什么,dfs出来就是什么,如果想输出的序列式有序的,先对原序列排序,保存原序列的下标。 搜索的时候和2610一样,多了一个判断条件,序列是递增的,下标也是递增的,还要判断他的下标是否递增,如果是符合条件 #include #include #include #include using namespace std;

leonharetd的专栏 787

BMS控制板硬件设计核心要点与工程避坑指南

电池管理系统(BMS)硬件设计是保障锂电安全与寿命的关键环节,其本质是模拟前端精度、数字控制可靠性、电源完整性及电磁兼容性四大要素的系统协同。理解AFE芯片(如BQ76920)的物理层约束、MCU与专用监控IC的异构分工逻辑,是构建高鲁棒BMS的基础;而晶振布局、I²C总线匹配、MOSFET体二极管方向、开尔文采样等细节,直接决定量产良率与EMC合规性。在电动工具、储能系统、两轮电动车等中低功耗BMS应用中,成本敏感型方案常采用STM32F0+AFE架构,此时电源滤波电容选型、复位电路ESR控制、TVS/齐

weixin_30591519的博客 260

YOLO26涨点改进 | Conv篇/小目标改进 | AAAI 2025 FBRT-YOLO 两个轻量级FCM和MKP模块, 助力无人机航拍任务VisDrone、UAVDT和AI-TOD高效涨点

本文提出FBRT-YOLO26模型,通过引入两个轻量级模块FCM和MKP优化航拍图像检测性能。FCM模块通过特征互补映射解决小目标信息丢失问题,MKP模块利用多尺度卷积核增强目标感知能力。在VisDrone等数据集上的实验表明,该方法在精度和速度上均优于现有实时检测器。文章详细介绍了模块结构、核心代码实现及YAML配置文件修改方法,为航拍图像中的小目标检测提供了高效解决方案。该模型实现了检测精度与效率的良好平衡,具有实际应用价值。

Ai缝合怪、助力小伙伴高效发论文 369

dfs 重判 HDU sequence two Problem X

Problem X Time Limit : 2000/1000ms (Java/Other)   Memory Limit :32768/32768K (Java/Other)Total Submission(s) : 2   Accepted Submission(s) : 0Problem DescriptionSearch is important in the acmalgorithm....

pxlsdz的博客 531

【GameFramework框架内置模块】2、数据节点(Data Node)

这一篇讲数据节点DataNode,基本开发程序都会有类似数据节点作用的东西,数据节点的作用其实就是保存游戏运行时的一些缓存数据,比如用户登录信息、用户名、任务节点等等。数据一般会有增删改查这四种操作,在运行时的数据一般是使用单例或者静态属性,将数据存储在内存中而数据节点也是将数据存储在内存中,但是不用序列化数据,比使用单例或者静态属性要容易维护的多,特别时它的树形结构可以让我们很好的组织我们的数据结构,方便做增删改查操作。数据节点DataNode模块的数据的存储方式是以树形结构存储。

优快云博客专家,Unity3D高级软件工程师,《Unity 3D从入门到实战》作者。 3184

HDU Sequence two 2611 DFS搜索判重

这题也是搜了解题报告才知道思路的,从此以后又多了项新技能了。。。。知道DFS怎么判重了 题意是在一连串数字中,找出前p个连续不下降子序列,按字典序,以数字为单位,1 ,23序列应该排在12,3序列的前面 这题最主要的难度是估计时间复杂度和判重。 时间复杂度:其实想一想,100个数字,每次扫描一遍这100个数字必定可以找出一个序列,p最大为100000,所以时间复杂度最大为o(

a549875231的专栏 1036

假人有限元模型

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

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

HDU 5288 OO‘s sequence (技巧)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5288 题面: OO’s Sequence Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 985    Accept

David_Jett 1325

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

hdu5288OO’s Sequence

//给一个序列 //定义函数f(l ,r) 为区间[l ,r] 中 //的数ai不是在这个区间其他任意数aj的倍数 //求所有f(l,r)之和 //对于每一个数a[i]找其最左的区间l[i]和最右的区间r[i] //包含a[i]且使得a[i]满足条件的个数为(i-l[i]+1)*(r[i] - i + 1) //对于每一个r[i]只要从左到右遍历 //pre[i] 表示i最后出现的位

ijbuhv的专栏 2002

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

搜索 - hdu5288 OO’s Sequence

题目: http://acm.hdu.edu.cn/showproblem.php?pid=5288 题意: 给定序列,问对该序列的每个区间,有多少个数字满足,在该区间中,其他数字都不是该数字的因数 思路: 观察数字范围只有10^4,算出每个数字极左因数的位置,极右因数的位置,则该数字贡献为(R-X)(X-L),其中X为该数字在序列中的位置 预处理算出10^4内每个数字的因数,用y

Keith_windniw的专栏 466

hdu 5288 OO’s Sequence

http://acm.hdu.edu.cn/showproblem.php?pid=5288题意:定义f(l,r)为区间中不能整除其余数的数的个数,求增序区间中f的和。直接求肯定T,那么就算每个位置的数对最终答案贡献了多少次,那就找到离他最近的左右两个他能整除的数的位置,ans+=l*r,记录位置,因为数的大小只有1000,所以枚举因子去找就ok了!#include<bits/stdc++.h> u

yp_2013的博客 372

HDU 5288 OO’s Sequence (暴力枚举因子)

题目链接:HDU 5288 OO’s Sequence 题意:给出一个n,表示n个数的序列,函数f(l,r)定义,在l,r区间中存在多少个数,不能被其他数整除。求累加所有子区间的函数值 思路:从ai的小范围入手 1.a不能被b整除,即a的所有因子中不存在b,所以打表枚举所有的数的因子。 2.找到一个数(位置为i)满足条件时最左端l和最右端r,(i-l)*(r-i)就是对答案的贡献。

n-1 840

hdu 5288OO’s Sequence

给你n个数,让你找到所有区间内不能整除其它数的数的个数之和#include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int mod = 1e9+7; #define ll long long #define N 111111ll l[N],r[N];//存储左边因子。右边因子的位置 int

wuhulala的休息室 1424
上一篇: 简单快速的算法
下一篇: HDU 5289 Assignment
丶阿明
博客等级 码龄12年 70粉丝 86原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值