当前位置:网站首页>P4552 differential
P4552 differential
2022-07-25 15:34:00 【Brother Tazi is here】

The first question is easy to see m a x ( p , n ) max(p,n) max(p,n)
Second questions , consider b [ 1 ] b[1] b[1] How many possible results can be formed by us .
The essence of making every number the same is to make the last of the difference group n − 1 n-1 n−1 All items become 0.
Every step of the process Namely Let a positive number –, negative ++.
Because it is necessary to ensure the minimum number of steps , Then there is at least m i n ( p , n ) min(p,n) min(p,n) The first step is from [ 2 , n ] [2,n] [2,n] Take out a pair at the same time +1-1
be left over a b s ( p − n ) abs(p-n) abs(p−n) Step , There are two kinds of decisions , Either with b [ 1 ] b[1] b[1] operation , Either with b [ n + 1 ] b[n+1] b[n+1] operation .
And because there is no difference in operation , We only look at the final result . b [ 1 ] b[1] b[1] The value range of is [ b [ 1 ] , b [ 1 ] + a b s ( p − n ) ] [b[1],b[1]+abs(p-n)] [b[1],b[1]+abs(p−n)].
Advanced :
Ask how many different solutions make them the same .
Any two schemes are different , The operation of a certain step is different
边栏推荐
- 图论及概念
- 2019 Shaanxi provincial competition j-bit operation + greed
- 2016 CCPC network trial c-change root DP good question
- 2021上海市赛-B-排序后dp
- Endnote 无法编辑range 解决
- MySQL optimization summary II
- Reflection - Notes
- Binary complement
- How to solve the login problem after the 30 day experience period of visual stuido2019
- Games101 review: linear algebra
猜你喜欢
SQL cultivation manual from scratch - practical part

《图书馆管理系统——“借书还书”模块》项目研发阶段性总结

Get the ask code corresponding to the key pressed by the keyboard

Geogle Colab笔记1--运行Geogle云端硬盘上的.py文件

MySQL transactions and mvcc

ML - 语音 - 传统语音模型

Cf888g clever dictionary tree + violent divide and conquer (XOR minimum spanning tree)

Ml speech depth neural network model

Understanding the difference between wait() and sleep()

PAT甲级1152 Google Recruitment (20 分)
随机推荐
二进制补码
4PAM在高斯信道与瑞利信道下的基带仿真系统实验
带你详细认识JS基础语法(建议收藏)
数据系统分区设计 - 分区再平衡(rebalancing)
2021上海市赛-B-排序后dp
<栈模拟递归>
Pytorch学习笔记--常用函数总结3
Binary complement
Submarine cable detector tss350 (I)
matlab randint,Matlab的randint函数用法「建议收藏」
matlab 优化工具 manopt 安装
Spark judges that DF is empty
图论及概念
Hdu3873 shortest path with dependency (topological sorting)
Graph theory and concept
wait()和sleep()的区别理解
Flex 布局
BPSK调制系统MATLAB仿真实现(1)
Pytorch框架练习(基于Kaggle Titanic竞赛)
Xcode添加mobileprovision证书文件报错:Xcode encountered an error