Codeforces Round #519D. Mysterious Crime(模拟+递推)

三相交错并联的boost变换器simulink仿真,电流双闭环控制策略 文章介绍了一种基于Simulink的三通道交错并联双向Buck-Boost变换器的设计与仿真。该变换器采用电压外环和三电流内环的控制策略,并通过120°载波移相技术实现Buck模式与Boost模式之间的平滑切换,有效避免了过压和过流问题。交错并联的拓扑结构不仅减少了电感电流的纹波,还缩小了每相电感的体积,提升了电路的响应速度,适用于储能系统。仿真过程完全离散化,采用离散解析器,主电路与控制部分以不同步长运行,更贴近实际应用。控制与采样环节均为手工搭建,未使用Matlab自带模块,展示了三相交错并联Boost 阅读详情

题目链接

题意

有m个长度为n的串,问其中公共的子串一共有多少个。

题解

这题第一想法是用后缀数组lcp暴力计数,但这样不是爆内存就是爆时间……仔细观察可以发现,每个序列都是一个 1 ∼ n 1\sim n 1∼n的排列,我们可以以第一个串为样式,将第一个串中的所有子串枚举出来,然后依次判断,这里枚举需要一个技巧。

假设第一个串的 s [ i + 1 , i + 2 ] s[i+1,i+2] s[i+1,i+2]在每个串中都出现,那么如果 s [ i , i + 1 ] s[i,i+1] s[i,i+1]在每个串中都出现的话, s [ i , i + 2 ] s[i,i+2] s[i,i+2]也都出现过。(注意这是一个排列,所以在每个串中每个数仅出现一次)

同理 s [ i , i + 2 ] s[i,i+2] s[i,i+2]如果都出现的话,当 s [ i − 1 , i ] s[i-1,i] s[i−1,i]都出现的话,那么 s [ i − 1 , i + 2 ] s[i-1,i+2] s[i−1,i+2]也都出现。 以此类推,我们发现只要判断每个 s [ k , k + 1 ] s[k,k+1] s[k,k+1]是否出现就可以推出所有的情况。
从后往前做即可。
我们可以很容易的用一个 p o s [ i ] [ j ] pos[i][j] pos[i][j]记录在第 i i i个串中,数字 j j j出现的位置。现在我们从后往前枚举第一个串的每个数字,用¥len[i]记录串 [ i , n ] , [ i + 1 , n ] … [ n , n ] [i,n],[i+1,n]\dots [n,n] [i,n],[i+1,n]…[n,n]出现的次数,比如12345,我们先考虑数字5,这肯定在所有串中都出现,所以 l e n [ 5 ] = 1 len[5] = 1 len[5]=1,现在考虑数字4,如果45都出现,那么就相当于加上5出现次数和4的次数,即 l e n [ 4 ] = l e n [ 5 ] + 1 len[4] = len[5]+1 len[4]=len[5]+1,再考虑数字3,如果34成立,那么345肯定成立,所以一旦34成立,那么相当于4出现的次数加上5出现的次数再上上3出现的次数len[3] = len[4]+1,否则len[3] = 1。

代码

#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+5;

int a[15][maxn], pos[15][maxn];
int len[maxn];
int main() {
	int n,m;
	scanf("%d%d", &n, &m);
	for(int i = 0; i < m; ++i)
		for(int j = 1; j <= n; ++j) {
			scanf("%d", &a[i][j]);
			pos[i][a[i][j]] = j;
		}
	long long ans = 0;
	for(int i = n; i >= 1; --i) {
		len[i] = 1;
		bool ok = true;
		for(int j = 1; j < m; ++j) {
			int p = pos[j][a[0][i]];
			if(p+1 > n || i+1 > n || a[j][p+1] != a[0][i+1])
				ok = false;
		}
		if(ok) len[i] = len[i+1]+1;
		// cout << len[i] << endl;
		ans += len[i];
	}
	printf("%lld\n", ans);

	return 0;
}
GD32F4xx 移植agile_modbus软件包与电能表通信 GD32F4XX 移植agile modbus软件包实现与DTSU电能表通信调试记录 阅读详情

相关推荐

PaddleOCR 3.x 最新版使用教程(2025)——从安装到实战身份证识别,一步到位!

本文针对PaddleOCR 3.x大版本更新带来的参数变化和兼容性问题,提供从环境配置到实际应用的全流程解决方案。

qq_58607032的博客 9789

codeforces 1557 C Moamen and XOR(递推、分类讨论)

codeforces 1557 C Moamen and XOR 题目链接 题目标签 递推、分类讨论 题目大意 有一个由nnn个大小不超过2k2^k2k的非负整数组成的数组aaa ,问有多少组aaa满足条件a1&a2&a3……&an≥a1⊕a2⊕a3……⊕an{a_1}\&{a_2}\&{a_3}……\&{a_n}\geq{a_1}⊕{a_2}⊕{a_3}……⊕{a_n}a1​&a2​&a3​……&an​≥a1​⊕a2​⊕a3​……

屋檐听雨丶 394

2.1 跟网型控制原理与局限性

本文深入分析了并网变流器的跟网型(GFL)控制技术及其局限性。GFL控制将变流器视为受控电流源,依赖锁相环(PLL)跟踪电网电压,在强电网下表现良好,但在弱电网中面临严峻挑战。研究发现,当电网短路比降低时,PLL动态与电网阻抗的负交互会导致系统失稳,同时GFL变流器缺乏电压支撑能力和惯量响应能力,在故障时易脱网。相比之下,构网型(GFM)控制具有电压源特性,能自主构建电网电压,更适合弱电网环境。随着新能源占比提高,GFL控制正逐渐被更具主动支撑能力的GFM控制所替代。

技术工作者 998

Codeforces 417 C

Football Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u SubmitStatus Description One day, at the "Russian Code Cup" event it was decided ...

weixin_30763397的博客 209

激光雷达接收芯片选型指南:APD、SiPM、SPAD阵列的优缺点对比

本文深入对比了激光雷达接收芯片APD、SiPM和SPAD阵列的核心技术原理与性能差异。APD作为线性模式工作的稳健选择,动态范围大;SiPM具备单光子探测和高增益优势;而SPAD阵列凭借像素级数字读出和集成TDC,在时间分辨率与系统集成度上领先。文章从灵敏度、时间精度、动态范围及系统成本等多维度剖析,为不同应用场景(如车载雷达、Flash LiDAR、消费电子)的芯片选型提供实战指南。

ik6789012的博客 659

PROFINET非周期数据通信实战:从报文解析到参数读写

本文详细解析了PROFINET非周期数据通信的实战应用,从报文结构到参数读写全流程。通过西门子PLC与驱动器的配置案例,深入讲解非周期通信在工业自动化中的关键作用,包括硬件选型、软件配置及常见问题排查,帮助工程师高效实现设备参数配置与诊断。

weixin_42522953的博客 514

CodeForces - 429B Working out(递推)

B. Working outtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSummer is coming! It's time for Iahub and Iahubina to work out, as they both want to...

surprisezang的博客 302

Raspberry Pi Pico SDK开发-Timer-定时

RP2040 由 Raspberry Pi 设计,具有双核 Arm Cortex-M0+ 处理器和 264KB 内部 RAM,并支持高达 16MB 的片外闪存。 广泛的灵活 I/O 选项包括 I2C、SPI 和独特的可编程 I/O (PIO)。 本实例将演示如何使用Timer的定时功能。

视觉与物联智能 2041

Codeforces1065G Fibonacci Suffix 【递推】【二分答案】

题目分析: 首先为了简便起见我们把前$15$的答案找出来,免得我们还要特判$200$以内之类的麻烦事。 然后我们从$16$开始递推。考虑猜测第i位是$0$还是$1$(这本质上是个二分)。一开始先猜是$1$,然后求是$0$的有多少个,与当前的$k$判断确认$0$和$1$。 然后考虑到某种情况就不输出的情况,实际上就是末尾的这个$ans$正好合法。 然后递推的时候除了将两个串原本出现的加起来,...

weixin_30701521的博客 254

【OpenClaw从入门到精通】第12篇:OpenClaw 2026子代理实战全攻略:用ACP架构搭建多智能体协作网络(附完整代码)

本文聚焦OpenClaw 2026.3.2版本默认启用的ACP(Agent Communication Protocol)子代理机制,从核心概念、底层原理到企业级实操全流程拆解。先解析子代理的定义、ACP协议通信原理及主从代理分工逻辑,再提供环境准备的详细步骤(版本验证、配置调整、技能安装);随后通过三个递进式虚拟案例(客服分流、智能文档处理、企业级招聘全流程),提供可直接运行的完整代码、执行结果及技术要点解析;最后补充子代理管理运维、性能优化与避坑指南。

专注于人工智能、软件开发、工控自动化、工厂数字化及智能化等领域,希望和大家共同进步! 2384

用 SAP ABAP ALV 重塑 SM30:可扩展的自定义表维护视图与自动传输实践

文章摘要: 本文提出了一种基于ALV Grid的动态表维护框架,用于替代传统SM30维护视图。该方案通过输入表名自动生成维护界面,支持动态筛选、批量操作和自动传输管理。核心设计包括:利用BAdI实现扩展点、通过行状态字段简化数据变更跟踪、使用Style Table控制单元格编辑权限、集成CTS实现自动传输。相比SM30标准维护,该框架显著提升了交互体验(支持ALV排序/过滤/汇总)和业务扩展性(统一校验与权限控制),同时解决了"维护+传输"流程割裂的问题。文中详细阐述了技术实现方案,并提

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

CodeForces - 1327E Count The Blocks (递推)

题目链接:https://vjudge.net/problem/CodeForces-1327E 分析 看样例很快可以发现n=1,i=1和n=2,i=2的答案相同。 再手算一下n=3时,答案为2610 180 10,n=4时,为34200 2610 180 10。 这样可以发现一个规律,即(n,i)的答案与(n-1,i-1)的答案是相同的,递推出(n-i+1,1)的答案也是相同的,而如果直接算(...

TK_wang_的博客 241

深度学习工具包 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&#39;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(&#39;DeepLearnToolbox&#39;));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(&#39;state&#39;,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&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,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 = &#39;sigm&#39;;%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, &#39;Too big error&#39;);```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(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;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)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;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, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% 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&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 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, &#39;Too big error&#39;);```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(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % 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, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);%% 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(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Codeforces Round #519 D - Mysterious Crime

题目 题意:   在m组数,每组有n个数(数的范围1-n)中,找到某些序列 使它是每组数的一个公共子序列,问这样的某些序列的个数? 思路: 不难想出答案ans是≥n的。 创立一个next数组,使每组中第i个数的next 是第i+1个数,即 nex[ a[i] ] = a[ i+1 ] (实际上设next是二维数组)。对第一组中的第i...

ampg66396的博客 144

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

【Codeforces Round #519 by Botan Investments D】Mysterious Crime

【链接】 我是链接,点我呀:) 【题意】 相当于问你这m个数组的任意长度公共子串的个数 【题解】 枚举第1个数组以i为起点的子串。 假设i..j是以i开头的子串能匹配的最长的长度。 (这个j可以给2..m这些数组用一个类似链表的东西很快得到,O((j-i+1)M)的复杂度即可完成。 那么我们会发现,我们不需要重新再从i+1开始枚举。 因为i..j这一段的任意一个子串都是满...

92

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

Codeforces Round #519 D. Mysterious Crime(思维)(1043D)

  题目链接:http://codeforces.com/contest/1043/problem/D        题意是给了n个数1-n,然后有1-m行,每行是一个1-n的排列数(不能重复),然后问这m行的公共子串有多少个。        显然暴力是不可取的...思路是我们先将每一行的一个数的前一个数存起来(相当于一个前驱数组),这样我们查找第i个数的时候就可以直接知道第i-1个数了,然...

Charles_Zaqdt的博客 583

Codeforces Round#519 D. Mysterious Crime【想法题】

【题意】:给你m个长度为n的排列,m&lt;=10,n&lt;=100000,让你求有多少种不同的公共子串。 【题解】:就目前而言,如果是在多个字符串中求不同的公共子串个数,还不是一个能在较低复杂度下就能解决的问题,所以这道题一定是有它自己特殊的地方:排列(permutaion)。因为是排列,那么每一个数字只会出现一次,那我们就能记录每一个字符串中每一个数字后面跟着的是谁,那么判断是否存在某个子...

顾业鸣 230

[题解]Codeforces Round #519 - D. Mysterious Crime

【题目】 D. Mysterious Crime 【描述】 有m个n排列,求一共有多少个公共子段。 数据范围:1<=n<=100000,1<=m<=10 【思路】 对于第一个排列来说,如果第k个位置开始往后L长的子段是一个公共的子段,那么从k开始往后数1,2,...,L-1长的子段都是公共的子段;如果第k个位置开始往后L长的子段是一个公共的子段,但第k个位置开始...

weixin_33717117的博客 156

codeforces 903D Almost Difference(递推式)

题意很简单,自己读吧思路: 对于 1,2,3,1,3,记录前缀和,思考前面的所有数到这个数的情况 a[i]*(i-1) - sum[i-1],即不考虑(a[i]-1和a[i]+1的数时,前面所有数到a[i]的结果,因为对于每个a[i]-1,相当于多加了一个1,对于每个a[i]+1,相当于多减了个1,所以用map统计前面每个数出现的次数。最后再把距离为1的数补回来即可。代码如下:#include<

henuzxy 585

Codeforces B. The Number of Products(递推)

传送门 思路:用递推就好了(我没有想到)。 #include<iostream> using namespace std; const int MAXN = 2e5+5; long long dp1[MAXN], dp2[MAXN]; //以i为结尾的,有dp1[i]个区间含有奇数个负数,dp2[i]个区间含有偶数个负数 long long a[MAXN]; int main(){...

qq_42944230的博客 428

codeforces 1472 C Long Jumps 递推

题面 题意 题解 开始想的的是直接模拟题意,遍历一遍然后求最大,TLE,继续优化,可以加记忆化搜索,把遍历过的标记,还是TLE 其实是一个递推,直接从后往前遍历即可 代码 #include<bits/stdc++.h> using namespace std; const int N = 2e5 + 10; typedef long long ll; ll t, n; ll a[N]; ll dp[N]; int main() { cin >> t;

qq_44791484的博客 407

Codeforces 892 B. Wrath (递推)(思维)

题意 每个人都有一个长度为 li 的武器,相邻的两个人之间距离为 1 ,同一时间所有人使用武器攻击左边的人,问最后存活下来的人数。 显然,最右侧的人一定是可以存活下来的。 我们维护一个 cntcnt 代表右侧延伸到当前位置的武器长度, 若 cnt>0说明当前位置在别人的攻击范围内,否则 ans+1 。 更新 cnt为 max(cnt−1,ai)看对于 ii 来说是否可以攻击到更远的位置。 时...

Victor的博客 372

codeforces 399 B. Code For 1 递推 规律

题目链接http://codeforces.com/contest/768/problem/B题意给一个数x,0<=x<=250x, 0 <= x <= 2^{50},当这个数大于1时,就把这个数变为x / 2, x % 2, x / 2的序列(这里的除法是整数除法),然后对这个序列接着进行这个操作,直到序列的所有数小于2。随后给出两个数l,r,0<=r−l<=105l, r, 0 <= r - l

Brassica_的菜园 851

codeforces - 789C 【分类+简单递推】

codeforces - 789C 【分类+简单递推】 1 #include <bits/stdc++.h> 2 #define rep(i,a,b) for(int i = a;i <= b;++ i) 3 #define per(i,a,b) for(int i = a;i >= b;-- i) ...

weixin_30888707的博客 672

Codeforces 892B Wrath (递推)

题目链接:点击打开链接 题目大意:每个人手里都有一个武器,武器的长度决定他们可以杀死前面多少个人的人数,只要铃声响起就可以开始刺杀,问铃声落下后,还有多少人活着? 解题思路:一开始我用暴力去写,抱着试试的心态,结果意料之中的TLE,然后还是死磕着从左往右遍历,但是想不出,然后想着从右往左,依次遍历,根据题意,最右边的人一定不会死,所有从他手里的武器的长度入手,开个变量依次维护可刺杀人数的最大值

猴子姑娘呀的博客 565
上一篇: Codeforces Round #519 by Botan Investments E. Train Hard, Win Easy(思维+贪心)
下一篇: Codeforces Round #519 by Botan Investments F. Make It One(容斥+组合数学)
Link_Ray
博客等级 码龄9年 44粉丝 156原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值