当前位置:网站首页>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 :

边栏推荐
- PAG experience: complete AE dynamic deployment and launch all platforms in ten minutes!
- How to enable radius two factor / two factor (2fa) identity authentication for Anheng fortress machine
- 安恒堡垒机如何启用Radius双因素/双因子(2FA)身份认证
- word中删除一整页
- Read PG in data warehouse in one article_ stat
- Nllb-200: meta open source new model, which can translate 200 languages
- Pandora IOT development board learning (HAL Library) - Experiment 12 RTC real-time clock experiment (learning notes)
- Jetson AGX Orin CANFD 使用
- JS in the browser Base64, URL, blob mutual conversion
- PAG体验:十分钟完成AE动效部署上线各平台!
猜你喜欢

Xiaomi's path of chip self-development

Promoted to P8 successfully in the first half of the year, and bought a villa!

Jetson AGX Orin CANFD 使用

广州开发区让地理标志产品助力乡村振兴

AWS学习笔记(三)

Yyds dry goods inventory # solve the real problem of famous enterprises: cross line

Wechat applet - Advanced chapter component packaging - Implementation of icon component (I)

拼多多败诉,砍价始终差0.9%一案宣判;微信内测同一手机号可注册两个账号功能;2022年度菲尔兹奖公布|极客头条...

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

《微信小程序-进阶篇》组件封装-Icon组件的实现(一)
随机推荐
时空可变形卷积用于压缩视频质量增强(STDF)
防火墙基础之服务器区的防护策略
Demis hassabis talks about alphafold's future goals
asp.netNBA信息管理系统VS开发sqlserver数据库web结构c#编程计算机网页源码项目详细设计
Notes de l'imprimante substance: paramètres pour les affichages Multi - écrans et multi - Résolutions
In the field of software engineering, we have been doing scientific research for ten years!
寺岗电子称修改IP简易步骤
ES日志报错赏析-trying to create too many buckets
ES日志报错赏析-- allow delete
Stm32cubemx, 68 sets of components, following 10 open source protocols
Differences between cookies and sessions
Today's sleep quality record 78 points
JSON解析实例(Qt含源码)
Jetson AGX Orin CANFD 使用
MicTR01 Tester 振弦采集模塊開發套件使用說明
IDA pro逆向工具寻找socket server的IP和port
PLC:自动纠正数据集噪声,来洗洗数据集吧 | ICLR 2021 Spotlight
Yyds dry goods inventory # solve the real problem of famous enterprises: cross line
Decrypt the three dimensional design of the game
MicTR01 Tester 振弦采集模块开发套件使用说明