💖 About the author: Hello, I'm brother cheshen, cheshen at No. 18 Fuxue road 🥇
⚡ About - > Che Shen: the fastest time from the bedroom to the laboratory is 3 minutes, and the slowest time is 3.5 minutes (that half minute is actually waiting for the traffic light)
📝 Personal homepage: Drivers only need cars and hands, and the pressure comes from the paper_ Cheshen, 18 Fuxue Road_ CSDN blog
🥇 Official certification: high-quality creators in the field of artificial intelligence
🎉 give the thumbs-up ➕ comment ➕ Collection = = form a habit (one button three times) 😋
⚡ I hope you can give me more support 🤗~ Let's come on together 😁
Brush one question every day without saying much. Brush the questions for nearly two years first. From 2020, if you have one together, you can join us!!!
Let's brush the questions together and impact the national competition!!!
Scan code My home page Group QR code on the left of the page.
Joining method: you can add me on the wechat business card below, and then pull you into the group. (remember the note code: I want to win the National Award)
Overview of the 11th Blue Bridge Cup in 2020
These are the questions in 2020. There are two types: result filling and program design. We brush one question every day. There is no problem in saving the game!
Snake filling number (topic)
(total score of this question: 25 points)
Official practice system: https://www.lanqiao.cn/problems/507/learning/
- > [problem description]
- > [enter description]
- > [output description]
The output line contains an integer representing the maximum value that can be obtained.
- > [input / output example]
2 1 2
2 2 2
1 5 1 2 3 5 8
2 4 2 4 8 15
3 2 5 10
- > [example description]
Inlay the beads in the following way to get the maximum value 18. The type number of inlaid decorative beads is indicated in brackets:
2: (1) (2)
4: (2) (2)
4 skill 1 decorative beads, 4 skill 2 decorative beads W 1 ( 4 ) + W 2 ( 4 ) = 5 + 15 = 20 W_1(4) + W_2(4) = 5 + 15 = 20 W1(4)+W2(4)=5+15=20.
By reading the stem of the question, this question - difficulty medium and above: ⭐⭐⭐⭐
Type of investigation: Number Theory
Knowledge points: dynamic programming + enumeration
As it is a blank question, we only need to get one result. The result is an integer.
This problem is very interesting. For engineering men who love to play games, it will be a bit embarrassing if they can't do this kind of buff problem (kidding, the problem is still difficult! ~) first of all, they have to understand the problem stem. In fact, they need to understand it!
Let's take a look at the input example:
Python code implementation:
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2022/2/27 15:04 # @Author: cheshen, 18 Fuxue Road # @Email : email@example.com # @File : Day06.py listlv=*5 listw=[[0 for i in range(8)]for i in range(5)] listl=*5 listp=*5 #First, use listlv to store the number of decorative holes of each grade (for example, listlv=3 indicates that there are 3 decorative holes of grade 1) for i in range(6): listinput=list(map(int,input().split())) for i in range(1,len(listinput)): listlv[listinput[i]]+=1 summ=0 m=int(input()) for i in range(m): listt=list(map(int,input().split())) listl[listt]=listt listp[listt]=listt listw[listt]=+listt[2:] #Enumerate the decorative beads of each grade from large to small for i in range(min(listlv,listp)+1): for j in range(min(listlv+listlv-i,listp)+1): for k in range(min(listlv+listlv+listlv-j-i,listp)+1): for l in range(min(listlv+listlv+listlv+listlv-j-i-k,listp)+1): summ=max(summ,listw[i]+listw[j]+listw[k]+listw[l]) print(summ) # 175
Today's question is verified in the system. If PyCharm can't verify it again~
We can get the result quickly
Today is the sixth day of brushing. The difficulty is medium and high. Welcome to join us, become stronger together, exercise self-discipline together, and go to the national competition together!!!
Today's topic is a little difficult. If you have different solutions, you can leave a message below~
Previous question brushing route:
|Question brushing route||Detail|
|Day-01||House plate making|
|Day-02||Looking for 2020|
|Day-04||Serpentine filling number|
Official question brushing exercise system: http://lx.lanqiao.cn/
❤ Keep reading Paper, keep taking notes, keep learning, and keep brushing LeetCode ❤!!!
Insist on writing questions!!! Impact national competition
⚡To Be No.1
⚡⚡ Ha ha ha ha
⚡ Creation is not easy ⚡， Crossing energy ❤ Follow, collect and like ❤ Three is the best
ღ( ´･ᴗ･` )