当前位置:网站首页>Niuke real problem programming - Day11
Niuke real problem programming - Day11
2022-07-07 14:52:00 【weixin_ forty-five million seven hundred and fifty thousand fou】
Compile environment :c++
1、 Cut grid paper
describe
Dudu bear has a piece of grid paper , But there are some dots on the paper , Every point is on the grid , If the grid is regarded as a coordinate system whose coordinate axis is parallel to the grid line , Each point can use a pair of integers x,y To express . Dudu bear must draw a square along the grid line , Make all points on the inside or boundary of the square . Then cut out this square . Ask the minimum area of the cut square .
Algorithmic thought :
If the topic wants to meet all the points , Cutting of minimum area , In fact, it is to ask for x Direction and y The maximum length in the direction , Then take the large value as the side length of the square to get the smallest square .
The code part implements :

2、 code
describe :
Suppose that the coding range of a code is a ~ y Of 25 Letters , from 1 A to 4 Bit code , If we sort the codes in dictionary order , Form an array as follows : a, aa, aaa, aaaa, aaab, aaac, … …, b, ba, baa, baaa, baab, baac … …, yyyw, yyyx, yyyy among a Of Index by 0,aa Of Index by 1,aaa Of Index by 2, And so on . Write a function , The input is any code , Output the corresponding Index.
Algorithmic thought :
Find the corresponding rule according to the requirements of the topic, which is the multiple relationship between each bit and a Location distance , Examples are analyzed regularly : General :temp=temp*25+(str[i]-'a'), The relationship between each person . If it is 4 Bit is 4 layer temp Of value and . Be careful when rounding +1, such as 4 Bit code , that 1、2、3 Bit time required +1.
The code part implements :

3、 Pay a bonus
describe :
Fox held a hacker marathon , The whole company is divided into N A set of , Each group has a room in a row to start the competition , The results were not announced after the game , But each group can see the score of the group with lower score in the two adjacent groups , Bonus will be given after the game , With 1w In units of , Each group will send at least 1w Bonus of , in addition , If a group finds that its bonus is not higher than that of the group with lower grades , Will not be satisfied , As the organizer of the competition , Calculate the minimum amount of bonus needed to satisfy all groups according to the results .
Algorithmic thought :
Traverse all groups , Every time 1w Bonus of the unit , If the current group scores higher than the previous group , Then pay the previous group of bonuses +1; Otherwise, the score of the current group is lower than that of the previous group , Then you need to traverse all the groups that have been sent before , Bonus for each group +1, Until the current group is greater than or equal to the previous group , Continue to traverse the Group . After traversal , Add up the bonus of each group and print it out .
The code part implements :

边栏推荐
- 6、Electron无边框窗口和透明窗口 锁定模式 设置窗口图标
- 属性关键字ServerOnly,SqlColumnNumber,SqlComputeCode,SqlComputed
- Navigation - are you sure you want to take a look at such an easy-to-use navigation framework?
- AWS学习笔记(三)
- leetcode:648. 单词替换【字典树板子 + 寻找若干前缀中的最短符合前缀】
- 大厂做开源的五大痛点
- PG基础篇--逻辑结构管理(锁机制--表锁)
- Webrtc audio anti weak network technology (Part 1)
- 昇腾体验官第五期随手记I
- JS in the browser Base64, URL, blob mutual conversion
猜你喜欢

Cvpr2022 | backdoor attack based on frequency injection in medical image analysis

全球首款 RISC-V 笔记本电脑开启预售,专为元宇宙而生!

Substance Painter筆記:多顯示器且多分辨率顯示器時的設置

Five pain points for big companies to open source

2022年13个UX/UI/UE最佳创意灵感网站
![[today in history] July 7: release of C; Chrome OS came out;](/img/a6/3170080268a836f2e0973916d737dc.png)
[today in history] July 7: release of C; Chrome OS came out; "Legend of swordsman" issued

Navigation — 这么好用的导航框架你确定不来看看?

The world's first risc-v notebook computer is on pre-sale, which is designed for the meta universe!

Instructions d'utilisation de la trousse de développement du module d'acquisition d'accord du testeur mictr01

KITTI数据集简介与使用
随机推荐
PLC: automatically correct the data set noise, wash the data set | ICLR 2021 spotlight
Wechat applet - Advanced chapter component packaging - Implementation of icon component (I)
一款你不容错过的Laravel后台管理扩展包 —— Voyager
"July 2022" Wukong editor update record
leetcode:648. 单词替换【字典树板子 + 寻找若干前缀中的最短符合前缀】
Instructions d'utilisation de la trousse de développement du module d'acquisition d'accord du testeur mictr01
#yyds干货盘点# 解决名企真题:交叉线
Data connection mode in low code platform (Part 2)
Today's sleep quality record 78 points
JS in the browser Base64, URL, blob mutual conversion
Mmkv use and principle
Several ways of JS jump link
Half an hour of hands-on practice of "live broadcast Lianmai construction", college students' resume of technical posts plus points get!
Nllb-200: meta open source new model, which can translate 200 languages
asp. Netnba information management system VS development SQLSERVER database web structure c programming computer web page source code project detailed design
Navigation - are you sure you want to take a look at such an easy-to-use navigation framework?
今日睡眠质量记录78分
Electronic remote error
Computer win7 system desktop icon is too large, how to turn it down
Es log error appreciation -- allow delete