0% found this document useful (0 votes)
15 views15 pages

RC Rccodepython

The RobotChallenge - RC.CODE.PYTHON competition tests contestants' Python programming skills through objective and programming questions, divided into two age groups. Each contestant has 90 minutes to complete the tasks on a designated platform, with strict rules against cheating and equipment requirements. Scoring is based on the number of questions completed and the time taken, with detailed requirements for programming tasks outlined for both age groups.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views15 pages

RC Rccodepython

The RobotChallenge - RC.CODE.PYTHON competition tests contestants' Python programming skills through objective and programming questions, divided into two age groups. Each contestant has 90 minutes to complete the tasks on a designated platform, with strict rules against cheating and equipment requirements. Scoring is based on the number of questions completed and the time taken, with detailed requirements for programming tasks outlined for both age groups.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

RobotChallenge - RC.CODE.

PYTHON

RC.CODE.PYTHON

1 Basic information
1.1 Competition content
A. he competition will comprehensively test the contestants' technical
implementation ability based on Python software programming language,
encourage innovation, cultivate practical skills, and problem-solving abilities.
B. The competition are participated by individuals.
C. The competition items are set with objective questions and programming
questions.
D. All groups in the competition participate in answering questions on the
designated platform using a computer.
E. The duration of each competition is 90 minutes.

1.2 Group setting

Programming programming Group division Age


event language requirement

Python Python Python - A ≤12 years old


programming
Python Python - B ≤18 years old

1.3 Competition topic

Group Single Choice Programming Competition


Question Questions time

Python - A 5 questions 5 questions, 90 Min


totaling 300 points totaling 300 points

Python - B 5 questions 5 questions, 90 Min


totaling 300 points totaling 300 points

2 Rules and scores


2.1 Competition rules
A. A. The competition requires contestants to use coding methods on the
designated platform to complete the designated questions. During the
answering process, it is prohibited to cut out the compiler or open other
software and web pages. Otherwise, it will be considered cheating and the
score will be cancelled.
RobotChallenge - RC.CODE.PYTHON
B. Each contestant has only one chance to challenge, and those who fail to log
in to the designated platform within the specified time will be considered as
giving up the challenge.
C. In the preparation stage, contestants must complete the answer preparation
according to the designated platform's prescribed steps and independently
operate to enter the formal answer.
D. During the competition period, contestants are not allowed to leave the
computer answering area.
E. During the competition period, contestants are not allowed to plagiarize
others, cheat, or directly contact other contestants' computers. If there is a
violation, the contestant will receive 0 points.
F. During the competition process, one is not allowed to seek help from others,
interfere with other contestants' preparation and answering questions, or
damage public equipment.
G. During the competition period, no communication software may be opened
on the computer. Any violation will result in 0 points for the contestant.
H. During the competition period, contestants are not allowed to use
communication, photography electronic devices such as mobile phones,
phone watches, and external storage devices. Any violation will result in
disqualification from the competition.
I. The interpretation of these rules belongs to the RC Organizing Committee.

2.2 Competition score


According to the completion status of the questions, as well as the comprehensive
evaluation of completion degree and time, the more questions completed, the
higher the completion degree, and the shorter the time, the higher the score of
the contestants.

3 Equipment requirements
A.Bring your own computer, computer operating system: Mac OS, Windows 10
or above operating system; The browser should use Google Chrome (version
69.0 or above), Firefox, Internet Explorer 11 or above, and Chrome is
recommended.
B. Bring your own smartphone.

4 Outline requirements
4.1 Python - A requirements
A. Input and Output:
RobotChallenge - RC.CODE.PYTHON
a. Conceptual understanding.
b. Use standard functions that focus on basic input and output and simple
operations.
B. Master the method of annotation.
C. Basic data types
a. The concepts of strings, numbers, and Boolean values.
b. Methods for representing data types.
c. Methods for converting between number types and string types
D. Variables
a. Conceptual understanding.
b. Variable assignment.
c. How to use variables.
E. Conditional statements
a. How to use if-else.
b. How to if-elif-else.
F. Operators
a. Representation and usage of comparison operators.
b. Representation and usage of logical operators.
G. Loop Structure
a. Use of infinite loop (while True).
b. Use break to jump out of the loop structure.
c. How to use the for loop.
H. Master the concept and usage of random numbers.
I. Be able to use programming to implement the four arithmetic operations and
mixed operations.
J. Master the common operations of creating, indexing, adding, deleting,
searching, modifying and traversing lists.
K. Master the common operations of creating, adding, deleting, searching,
modifying and traversing dictionaries.
L. Function
a. Understand the definition and calling methods of functions.
b. Understand the definition and use of parameters and return values.
M. Use different algorithms to solve various common problems.

4.2 Python - B requirements


A. Input and Output:
a. Conceptual understanding.
b. Use standard functions that focus on basic input and output and simple
operations.
RobotChallenge - RC.CODE.PYTHON
B. Master the method of annotation.
C. Basic data types
a. The concepts of strings, numbers, and Boolean values.
b. Methods for representing data types.
c. Methods for converting between number types and string types
D. Variables
a. Conceptual understanding.
b. Variable assignment.
c. How to use variables.
E. Conditional statements
a. How to use if-else.
b. How to if-elif-else.
F. Operators
a. Representation and usage of comparison operators.
b. Representation and usage of logical operators.
G. Loop Structure
a. Use of infinite loop (while True).
b. Use break to jump out of the loop structure.
c. How to use the for loop.
H. Master the concept and usage of random numbers.
I. Be able to use programming to implement the four arithmetic operations and
mixed operations.
J. Master the common operations of creating, indexing, adding, deleting,
searching, modifying and traversing lists.
K. Master the common operations of creating, adding, deleting, searching,
modifying and traversing dictionaries.
L. Function
a. Understand the definition and calling methods of functions.
b. Understand the definition and use of parameters and return values.
M. Use different algorithms to solve various common problems.
N. Master the use of the range() method.
O. Master the method of searching for elements in a two-dimensional list by
index.
P. Master the nested use of dictionaries and lists.
Q. Master the use of basic event handling modules.
RobotChallenge - RC.CODE.PYTHON
5 RC.CODE.Python Sample question example
【Python - A 】Sample question example
一、 Multiple choice questions (20 points each)
1、In computers, which two digits are used in the binary number system?( )

A、0 和 1
B、0 和 2
C、1 和 2
D、1 和 10
Answer A

2、If the tuple y = (‘A’, ‘B’, ‘C’, ‘D’), then the statement that can
return the element ‘A’ is( )

A、y[-3]
B、y[1]
C、y[0]
D、y[4]
Answer C

3、Initially x = 5, the value after x // 2+x**2 operation is( )

A、26.5
B、26
C、27.5
D、27
Answer D

4、The final print result of the following program( )


l = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ,9 ]
print ( l [2 : 4] )

A、[ 2 , 3 ]
B、[ 1 , 2 , 3 ,4 ]
C、[ 3 , 4 ]
D、[ 2 , 3 ,4 ]
Answer C
RobotChallenge - RC.CODE.PYTHON
5、Execute the following program and the print result is( )
L = []
for letter in 'Python':
if letter == 'n':
continue
L.append(letter)
print(L)

A、[]
B、['P' , 'y' , 't' , 'h']
C、['P' , 'y' , 't' ,' h' , 'o']
D、['o', 'n']
Answer C

二、Programming questions (total score 300 points)


1、Programming Question 1(40 point)

Programming Implementation:
Given a lowercase letter, output its corresponding uppercase letter.

Input description:
Input a lowercase letter
Output description:
Output the uppercase letter corresponding to the lowercase letter

Sample input:
a
Sample output:
A

Scoring Criteria:

10 point:correctly output a set of data;

10 point:correctly output two sets of data;

10 point:correctly output three sets of data;

10 point:correctly output four sets of data;


RobotChallenge - RC.CODE.PYTHON
2、Programming Question 2(40 point)

Programming Implementation:
Enter a positive integer N (4< N < 40), and then print out N rows and N columns
of asterisks (*).

Input description:
Enter a positive integer N
Output description:
Print out N rows and N columns of "*"

Sample input:
5
Sample output:

Scoring Criteria:

10 point:correctly output a set of data;

10 point:correctly output two sets of data;

10 point:correctly output three sets of data;

10 point:correctly output four sets of data;

3、Programming Question 3(60 point)

Programming Implementation:
Given a positive integer N, and M different positive integers. Then combine any
two numbers from the M positive integers, and find the sum of each combination.
How many combinations of M positive integers have the sum exactly equal to N.
For example: positive integer N is 6, M is 5, and the 5 different positive integers
are 1, 2, 3, 4, and 5.
There are 10 combinations of any two numbers: 1+2, 1+3, 1+4, 1+5, 2+3, 2+4,
2+5, 3+4, 3+5, 4+5
There are 2 combinations whose sum is exactly equal to 6: 1+5, 2+4
RobotChallenge - RC.CODE.PYTHON
Input description:
Enter a positive integer N in the first line
Enter M different positive integers in the second line, and the positive integers are
separated by an English comma
Output description:
Output how many combinations of M different positive integers have the sum
exactly equal to N

Sample input:
5
1,2,3,4,5
Sample output:
2

Scoring Criteria:

15 point:correctly output a set of data;

15 point:correctly output two sets of data;

15point:correctly output three sets of data;

15 point:correctly output four sets of data.

4、Programming Question 4(60 point)

Programming Implementation
N children stand in a circle (N≤60) and are numbered in order (numbered 1 to N).
Then the child numbered 1 starts to count continuously. When the number
reported contains 3 or is a multiple of 3, the child cannot report the number but
reports "pass" (for example, 3, 6, 13, 31 are all reported "pass").

In a game, the children were having a lot of fun. Suddenly, one child found that
there was an error in the number reported before, and the children behind were
still reporting. Please help the children find out the number of the child who
reported the error for the first time.

For example: There are 3 children, numbered 1, 2, and 3. The child numbered 1
reports 1, the child numbered 2 reports 2, the child numbered 3 reports "pass",
the child numbered 1 reports 4, the child numbered 2 reports 5, the child
numbered 3 reports 6, and the child numbered 1 reports 7; at this time, the child
RobotChallenge - RC.CODE.PYTHON
who reported the error for the first time is numbered 3. (Because the child number
3 should have reported "passed", but reported "6", and "6" is a multiple of 3)

Input description:
In the first line, enter a positive integer N, which represents the number of
children
In the second line, enter a set of incorrect reporting sequences ("0" represents a
number containing 3 or a multiple of 3), and the sequence elements are separated
by an English comma
Output description:
Output the number of the child who reported the error for the first time

Sample input:
3
1,2,0,4,5,6,7
Sample output:
3

Scoring Criteria:

15 point:correctly output a set of data;

15 point:correctly output two sets of data;

15point:correctly output three sets of data;

15 point:correctly output four sets of data.

5、Programming Question 5(100 point)

Programming Implementation:
The pony needs to carry N items from one side of the river to the other side, with
1 to 3 items carried each time. How many ways are there for the pony to carry all
N items?

For example: N=3, there are 4 ways to carry all 3 items:


Solution 1: Carry 1 item the first time, 1 item the second time, and 1 item the third
time;
Solution 2: Carry 1 item the first time, 2 items the second time;
Solution 3: Carry 2 items the first time, 1 item the second time;
Solution 4: Carry 3 items at a time.
RobotChallenge - RC.CODE.PYTHON
Input description:
Input a positive integer N, representing the number of items to be carried
Output description:
Output how many ways are there to carry all N items

Sample input:
3
Sample output:
4

Scoring Criteria:

25 point:correctly output a set of data;

25 point:correctly output two sets of data;

25point:correctly output three sets of data;

25 point:correctly output four sets of data.

【Python - B】Sample question example


1. Multiple choice questions (20 points each)
2. Which of the following expressions returns True?( )

A、3 != 3
B、5 > 4 > 3
C、8 % 2 == 1
D、True and False
Answer B

2、Which of the following descriptions of the function is correct?( )

A. The function definition must be at the beginning of the program


B. After the function is defined, it must be called to execute
C. The function body and the keyword def must be left-aligned
D. After the function is defined, its program can be automatically executed
Answer B

3、What does the following function determine?( )


def is_prime(num):
for i in range(2, num):
RobotChallenge - RC.CODE.PYTHON
if num % i == 0:
return False
return True
A. Addition calculation
B. Determine prime number
C. Loop index
D. Sorted list
Answer B

4、When the following expressions traverse the dictionary d, the variable x


represents the dictionary value.( )

A、for x in d:
B、for x in d.keys():
C、for x in d.items():
D、for x in d.values():
Answer D

5、Given t = ("bian", "cheng", "sai"), the output of executing t[::-1] is( )

A、
(“sai”,“cheng”,“bian”)
B、 [“sai”,“cheng”,“bian”]
C、 {“sai”,“cheng”,“bian”}
D、 运行报错
Answer A

二、 Programming questions (total score 300 points)

1、Programming Question 1(40 point)

Programming Implementation:
Input the length and width of a rectangle and output the area of the rectangle.

Input description:
Input the length and width of a rectangle (separated by a comma)
Output description:
Output the area of the rectangle
RobotChallenge - RC.CODE.PYTHON
Sample input:
34
Sample output:
12

Scoring Criteria:

10 point:correctly output a set of data;

10 point:correctly output two sets of data;

10 point:correctly output three sets of data;

10 point:correctly output four sets of data.

2、Programming Question 2(40 point)


Programming Implementation:
Given a four-digit positive integer, output it in reverse order.

Input description:
Input a four-digit positive integer whose single digit is not "0"
Output description:
Output this positive integer in reverse order

Sample input:
1234
Sample output:
4321

Scoring Criteria:

10 point:correctly output a set of data;

10 point:correctly output two sets of data;

10 point:correctly output three sets of data;

10 point:correctly output four sets of data.

3、Programming Question 3(60 point)


Programming Implementation:
There are N positive integers. Now arrange them in different ways. After each
arrangement, a calculation is performed according to the following rules. For
example, different arrangements will result in different results.
RobotChallenge - RC.CODE.PYTHON
Calculation rules:
First time: multiply the first number by the second number by the third number,
and record the result as M(1);
Second time: multiply the second number by the third number by the fourth
number, and record the result as M(2);
Third time: multiply the third number by the fourth number by the fifth number,
and record the result as M(3);
N-2nd time: multiply the N-2nd number by the N-1st number by the Nth number,
and record the result as M(N-2).
Finally, calculate the value of M(1)+M(2)+M(3)......M(N-2).
Find an arrangement that maximizes this value.
For example: N=4, 4 positive integers are 1, 2, 3, 4, then there are 24 ways of
arrangement:
When the arrangement is 1, 3, 4, 2, calculate twice according to the rule:
1*3*4=12, 3*4*2=24; product addition: 12+24=36
This sorting method is that the maximum value of all product additions is 36.

Input description:
Input N positive integers (3≤N), separated by a comma
Output description:
Find the arrangement with the largest value of all product additions, and output
the value

Sample input:
1,2,3,4
Sample output:
36

Scoring Criteria:

15 point:correctly output a set of data;

15 point:correctly output two sets of data;

15point:correctly output three sets of data;

15 point:correctly output four sets of data.

4、Programming Question 4(60 point)

Programming Implementation:
RobotChallenge - RC.CODE.PYTHON
Given a row of black balls with numbers (numbers from 0 to 9), and a row of white
balls with numbers (numbers from 0 to 9), now select K balls from the two rows
and arrange them in a row, so that the number formed by the new row of K balls
is the largest.

For example:
The original order of the black balls is:

The original order of the white balls is:

K is 3;
Select 3 balls from the two rows and arrange them in。The maximum
number that can be formed is 654。
Input description:
In the first line, enter a group of positive integers, representing black balls. Each
positive integer ranges from 0 to 9, and the positive integers are separated by a
comma.
In the second line, enter a group of positive integers, representing white balls.
Each positive integer ranges from 0 to 9, and the positive integers are separated
by a comma.
In the third line, enter a positive integer K (K is less than or equal to the total
number of all balls), indicating that K balls are selected from all balls.
Output description:
Output an integer, indicating the maximum number formed after selecting K balls
as required.

Sample input:
2,5,3
6,2,4,1
3
Sample output:
654

Scoring Criteria:

15 point:correctly output a set of data;

15 point:correctly output two sets of data;

15point:correctly output three sets of data;

15 point:correctly output four sets of data.


RobotChallenge - RC.CODE.PYTHON

5、Programming Question 5(100 point)

Programming Implementation:
There is a sequence a containing n positive integers. We plan to sort the sequence
in ascending order multiple times. Each time we sort in ascending order, we select
an interval [l, r] (l, r) and sort all the numbers in the interval, i.e. al, al+1, …, ar, in
ascending order. Each ascending order is performed on the result of the previous
ascending order. Now please calculate the sequence after multiple ascending
orders.

Input description:
The first line contains a positive integer n, which means the same as the title.
The second line contains n positive integers a1, a2, · · ·, an, representing the
sequence. The third line contains a positive integer q, which represents the
number of sorting times. Each line contains two positive integers li, ri, which
represent sorting all numbers in the interval [li, ri] in ascending order.
Output description:
Output a line containing n positive integers, representing the sequence after
multiple ascending sortings.

Sample input:
5
34521
3
45
34
13
Sample output:
13452

Scoring Criteria:

25 point:correctly output a set of data;

25 point:correctly output two sets of data;

25point:correctly output three sets of data;

25 point:correctly output four sets of data.

You might also like