当前位置:网站首页>[learning notes] stage test 1
[learning notes] stage test 1
2022-07-05 14:18:00 【Ants looking up at the starry sky】
Menci Sequence
Binary system + structure + greedy
At first glance dp . Think about 1.5h , Can't think of the state .
I'll mess around ! fool around with 80pts .
First, transform the original sequence . be aware 1000=010
After such construction, it is continuous + No more than 2 individual
Then we are greedy from high to low .
Obviously, we should use the least + To construct the .
So try not to carry the highest bit .
It is not difficult to think of a greedy plan : Traverse continuous... From left to right + paragraph , For each successive + Take only one , Each segment is continuous * Only take one , The prefix must be 1111…
If you encounter a suffix * Insufficient situation , So this paragraph * There must be a number of >=2 , Enough to isolate the influence of the later choice on the front ( In other words, it is impossible to carry ), Then we just need to let the latter + Contribute as much as possible to the answer .
It can be understood by adding two binary numbers .
You have to ask how this greed came to mind , I don't know either , Maybe it's a feeling .
Sort
Worship idsy …
The first feeling of this question is a fierce search .
Of course, this question is too boring if it can only be searched violently .
such as Limak and Shooting Points It can be called a search topic .
In fact, the positive solution is quite obvious .
consider <=i All operations are used , So for a length of 2 i − 1 2^{i-1} 2i−1 The internal order of the block has been determined , Rather as a whole .
If every paragraph is legal , The operation is not performed ; If a paragraph is illegal , Before and after the exchange ; If two paragraphs are illegal , Then classified discussion , At most 2 2 2 An exchange method .
Such a possible situation 2 n 2^n 2n Kind of , The sum O ( 4 n ) O(4^n) O(4n) .
Be careful not to forget factorial .
边栏推荐
- R language ggplot2 visualization: visual line graph, using legend in theme function The position parameter defines the position of the legend
- How to deeply understand the design idea of "finite state machine"?
- 日化用品行业智能供应链协同系统解决方案:数智化SCM供应链,为企业转型“加速度”
- R language dplyr package select function, group_ By function, mutate function and cumsum function calculate the cumulative value of the specified numerical variable in the dataframe grouping data and
- 享你所想。智创未来
- R Language ggplot2 Visualization: visualize linegraph, using Legend in Theme function. Paramètre de position emplacement de la légende personnalisée
- 【学习笔记】阶段测试1
- TDengine 社区问题双周精选 | 第三期
- R語言ggplot2可視化:可視化折線圖、使用theme函數中的legend.position參數自定義圖例的比特置
- Zhizhen new energy rushes to the scientific innovation board: the annual revenue is 220million, and SAIC venture capital is the shareholder
猜你喜欢

【学习笔记】阶段测试1

Simple process of penetration test

分享 20 个稀奇古怪的 JS 表达式,看看你能答对多少

Zhizhen new energy rushes to the scientific innovation board: the annual revenue is 220million, and SAIC venture capital is the shareholder

Opengauss database source code analysis series articles -- detailed explanation of dense equivalent query technology (Part 2)

如何深入理解“有限状态机”的设计思想?

Tiflash compiler oriented automatic vectorization acceleration

Shen Ziyu, nouveau Président de Meizu: M. Huang Zhang, fondateur de Meizu, agira comme conseiller stratégique pour les produits scientifiques et technologiques de Meizu

让秒杀狂欢更从容:大促背后的数据库(下篇)

软件测试人在深圳有哪些值得去的互联网公司【软件测试人员专供版】
随机推荐
04_solr7.3之solrJ7.3的使用
享你所想。智创未来
MySQL user-defined function ID number to age (supports 15 / 18 digit ID card)
广发期货排名多少?网上办理广发期货开户安全可靠吗?
LeetCode_ 3 (longest substring without repeated characters)
Detailed explanation of SSH password free login
鸿蒙第四次培训
世界环境日 | 周大福用心服务推动减碳环保
How can non-technical departments participate in Devops?
Hongmeng fourth training
Time to calculate cron expression based on cronsequencegenerator
3W原则[通俗易懂]
Postman简介、安装、入门使用方法详细攻略!
ASP.NET大型外卖订餐系统源码 (PC版+手机版+商户版)
R language ggplot2 visual bar graph: visualize the bar graph through the two-color gradient color theme, and add label text for each bar (geom_text function)
TDengine 社区问题双周精选 | 第三期
一网打尽异步神器CompletableFuture
无密码身份验证如何保障用户隐私安全?
R語言ggplot2可視化:可視化折線圖、使用theme函數中的legend.position參數自定義圖例的比特置
Sharing the 12 most commonly used regular expressions can solve most of your problems