当前位置:网站首页>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 :
边栏推荐
- Novel Slot Detection: A Benchmark for Discovering Unknown Slot Types in the Dialogue System
- STM32CubeMX,68套组件,遵循10条开源协议
- Protection strategy of server area based on Firewall
- 【愚公系列】2022年7月 Go教学课程 005-变量
- AWS learning notes (III)
- Andriod --- JetPack :LiveData setValue 和 postValue 的区别
- What is cloud primordial? This time, I can finally understand!
- Cocoscreator operates spine for animation fusion
- The method of parsing PHP to jump out of the loop and the difference between continue, break and exit
- 因员工将密码设为“123456”,AMD 被盗 450Gb 数据?
猜你喜欢
潘多拉 IOT 开发板学习(HAL 库)—— 实验12 RTC实时时钟实验(学习笔记)
Infinite innovation in cloud "vision" | the 2022 Alibaba cloud live summit was officially launched
Bill Gates posted his resume 48 years ago: "it's not as good-looking as yours."
时空可变形卷积用于压缩视频质量增强(STDF)
Substance painter notes: settings for multi display and multi-resolution displays
Jetson AGX Orin CANFD 使用
C 6.0 language specification approved
The world's first risc-v notebook computer is on pre-sale, which is designed for the meta universe!
大厂做开源的五大痛点
Navigation - are you sure you want to take a look at such an easy-to-use navigation framework?
随机推荐
Ian Goodfellow, the inventor of Gan, officially joined deepmind as research scientist
找到自己的价值
比尔·盖茨晒48年前简历:“没你们的好看”
2022年13个UX/UI/UE最佳创意灵感网站
小米的芯片自研之路
Full details of efficientnet model
云上“视界” 创新无限 | 2022阿里云直播峰会正式上线
上半年晋升 P8 成功,还买了别墅!
寺岗电子称修改IP简易步骤
Jetson AGX Orin CANFD 使用
Applet directory structure
Differences between cookies and sessions
缓冲区溢出保护
JS in the browser Base64, URL, blob mutual conversion
Protection strategy of server area based on Firewall
Electronic remote error
「2022年7月」WuKong编辑器更版记录
Attribute keywords ondelete, private, readonly, required
electron remote 报错
Half an hour of hands-on practice of "live broadcast Lianmai construction", college students' resume of technical posts plus points get!