Lanqiao Cup-02-Lanqiao Cup Java group test points and 14th real questions

Lanqiao Cup Java group test points and 14th real questions

Reference resources

Regulations of the 15th Lanqiao Cup Competition (Individual Competition)
Competition Management Measures for the Individual Competition of Lanqiao Cup Competition (Software/Electronic Category)
Competition Subjects
Competition Outline of the 15th Lanqiao Cup Competition (Individual Competition)
Previous Questions of Lanqiao Cup Competition

Java group test points

The 15th Lanqiao Cup National Software and Information Technology Professional Talent Competition Individual Competition
(Software Competition) Java Group Competition Rules and Instructions

1. Group

Java software development is divided into: graduate student group, university group A, university group B and university group C.
Each player can only apply to participate in one of the categories. Each category will be judged separately.
Graduate students can only apply for the postgraduate group.
Undergraduate students from key undergraduate colleges (985, 211), graduate students only, or university group A.
Undergraduate students from other undergraduate institutions can apply for university group B and above.
Other higher vocational colleges can choose to apply for any group.

2. Competition Schedule

Provincial Competition Duration: 4 hours.
Finals duration: 4 hours.
The detailed schedule is subject to the information announced by the organizing committee.

3. Competition format

Individual competitions, provincial competitions, and finals are all conducted in a closed and time-limited manner.
The player’s machine is connected to the competition server in each examination room through the LAN.
Contestants are not allowed to access the Internet during the answer process, nor are they allowed to use resources other than the local machine (such as USB connection).
The competition system uses a "server-browser" method to issue test questions and collect contestant answers.
Players submit their answers to the competition system. They will not be able to submit after the competition time.

4. Contestants’ machine environment

Contestant machine configuration:
X86 compatible machine, memory not less than 4G, hard disk not less than 60G
Operating system: Windows7, Windows8, Windows10 or Windows11
Java language development environment:
JDK 1.8
Eclipse-java-2020-06
API Help Documentation

5. Question format

The competition questions are completely objective. The specific question types and number of questions are subject to the questions in the official competition. The scoring is based on the
evaluation results of the answers submitted by the players.

5.1. Result fill-in-the-blank questions

The question describes a problem with a definite solution. Players are asked to fill in the blanks with their solutions to the problems.
The problem-solving process is not required, and the problem-solving method is not limited (any development language or tool can be used, even hand calculation). It is only required to fill in the final result.
The final solution is an integer or a string. The final solution can be expressed using ASCII characters.

5.2. Big programming questions

The question contains a clear description of the problem, input and output formats, and sample data used to explain the problem.
The problems involved in major programming questions must have clear and objective standards to judge whether the results are correct, and the results can be evaluated through programs.
Contestants should write a program to solve the problem based on the problem description. During the evaluation, the contestant's program should read data from the standard input and output the final result to the standard output.
The given conditions and restrictions will be clearly stated in the problem description, and the task of the problem will be clarified. The contestant's program should be able to solve all possible situations under the given conditions and restrictions.
The contestant’s program should be universal and cannot only be applied to the sample data of the question.
In order to test the performance of the solutions provided by the players, the test cases used in scoring may include stress test cases with large amounts of data. Players should consider feasibility and efficiency issues as much as possible when selecting algorithms.

6. Scope of test questions

The test questions test the contestants’ ability to solve practical problems. For the fill-in-the-blank questions, contestants can use hand calculations, software, programming and other methods to solve
. For programming questions, contestants can only Use programming to solve.
The competition focuses on testing the contestants’ ability to use algorithms and data structures flexibly. Many test questions require the use of computer algorithms to effectively
solve them.
The scope of examination includes:

以下范围中标*的部分只限于 Java 研究生组、Java 大学 A 组

Java 软件开发基础:包含使用 Java 编写程序的能力。该部分不考查选手对某一语法的理解程度,
选手可以使用自己喜欢的语句编写程序。选手可在程序中使用 JDK 中自带的类,但不能使用其它的第三方类。

计算机算法:枚举、排序、搜索、计数、贪心、动态规划、图论、数论、博弈论*、概率论*、计
算几何*、字符串算法等。
数据结构:数组、对象/结构、字符串、队列、栈、树、图、堆、平衡树/线段树、复杂数据结构*
嵌套数据结构*等。

7. Answer submission

Only the answers submitted by contestants during the competition time can be used for evaluation, and any submissions after the competition are invalid.
Contestants should use the webpage designated for the exam to submit code. Submissions in any other way (such as email, USB flash drive) will not be used as the basis for evaluation.
Contestants can view their previously submitted code at any time during the competition, and can also resubmit the answer to any question. For each question, only the last submission is saved and used as the basis for evaluation. in accordance with. During the competition, the evaluation results will not be displayed to the players, and the players should design their own data and debug their own programs without feedback.
For each question, contestants should copy and paste the answer to the question onto the webpage for submission.
The program should only contain calculation modules and should not contain any other modules, such as graphics, system interface calls, system interrupts, etc.
All calls to system interfaces should be made through the standard library.
The libraries referenced in the program should be written in the form of source code in the program, and should also be submitted together with other parts of the program when submitting.

8. Rating

All are automatically graded using machines.
For the result fill-in-the-blank question, the question is guaranteed to have only one solution. The player’s result will only be scored if the solution is exactly the same. , the format appears No points will be awarded for errors or
redundant content.
For major programming questions, the evaluation system will use multiple evaluation data to test the program. Each evaluation data has a corresponding score.
The program submitted by the contestant will be run using each evaluation data as input. For a certain evaluation data, if the output of the player's program matches the correct answer, the player gets a score for that evaluation data.
The evaluation data used in the evaluation is generally different from the sample input and output given in the test questions. Therefore, it is recommended that contestants use
different data to test themselves before submitting the program. program of.
The submitted program should be output in strict accordance with the requirements of the output format, including the requirements for output spaces and line breaks . If the program does not follow the requirements of the
output format, it will be judged as an incorrect answer. Please note that if the program outputs extra content during output, it does not follow the output format requirements, so please do not output any extra content when outputting, such as debugging output.

Java contestants must not use the package statement, and ensure that the name of their main class is Main. Otherwise, the evaluation system will not be able to find the main class when running and will get 0 points.

If Java contestants reference a class library in their program, they must submit the import statement together with other parts of the program when submitting.
Only Java's own class libraries are allowed.

9. Sample questions

Sample question 1: Rectangular cutting (result fill-in-the-blank question)

[Problem Description]
Xiao Ming has some rectangular materials, and he wants to cut some squares from these rectangular materials.
When he faces a rectangular piece of material, he always cuts out the largest square, leaving a rectangular piece, and then
Cut the remaining rectangular material until it is all square.
For example, for a piece of material with 5 and 3 on both sides (recorded as 5×3), Xiao Ming will cut out 3×3, 2×2, 1×1, and 1 in sequence. The answer to this question is: 21 Finally get the cut out Calculating the number of rectangles by hand may take some time. If the contestant uses methods such as division to speed up calculations by hand, the time may be less. If players write programs to calculate, errors in hand calculations can be reduced. Note: The above is the description of the problem. When solving the problem, contestants can directly calculate the answer by hand, that is, cut it step by step according to the meaning of the problem. This is a fill-in-the-blank question. You only need to calculate the result and submit it. The result of this question is an integer. Only fill in this integer when submitting the answer. No points will be awarded if you fill in excess content. [Answer submission] Now Xiao Ming has a rectangular piece of material, with the lengths of both sides being 2019 and 324 respectively. How many squares will Xiao Ming finally cut out?
×1 4 squares in total.






Sample question 2: Sum of special numbers (major programming question)

[Problem Description]
Xiao Ming is very interested in numbers containing 2, 0, 1, and 9 in the digits (excluding leading 0). Such numbers from 1 to 40 Including 1,
2, 9, 10 to 32, 39 and 40, a total of 28, and their sum is 574.
What is the sum of all such numbers from 1 to n?
[Input format]
Enter a line containing an integer n.
[Output format]
Output a line, including an integer, representing the sum of numbers that meet the condition.
[Sample input]
40
[Sample output]
574 Description: This question is a programming question. Players need to write a program to solve the problem. A reference program is given below. Other programs written by players will be awarded points as long as they can give correct results. For all evaluation cases, 1≤n≤10000. For 80% of the evaluation cases, 1≤n≤1000. For 50% of the evaluation cases, 1≤n≤100. For 20% of the evaluation use cases, 1≤n≤10.
[Evaluation use case scale and agreement]




import java.util.Scanner;
public class Main{
    
    
    public static void main(String[] args){
    
    
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int sum=0;
        for(int i=1;i<=n;i++) {
    
    //遍历1到n的数,如果符合条件则加一
            if(f(i)) {
    
    
                sum+=i;
            }
        }
        System.out.println(sum);
    }
    public static boolean f(int n) {
    
    //判断一个数中是否至少有一个位上是2 0 1 9 其中一个数
        int k;
        int sum=0;
        while(n!=0) {
    
    
            k=n%10;
            if(k==2||k==0||k==1||k==9) {
    
    
                return true;
            }
            n/=10;
        }
        return false;
    }      
}
import java.util.*;
public class Main
{
    
    
    public static void main(String[] args)
    {
    
    
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), ans = 0;
        for (int i = 1; i <= n; ++i)
        {
    
    
            int t = i;
            boolean ok = false;
            while (t > 0)
            {
    
    
                int g = t % 10;
                if (g==2 || g==0 || g==1 || g==9)
                    ok = true;
                t = t / 10;
            }
            if (ok)
                ans += i;
        }
        System.out.println(ans);
    }
}

10. Other matters needing attention

(1) Players must meet the qualifications and must not commit fraud. If a problem is discovered during the qualification review, the applicant's registration qualification will be cancelled;
If a problem is discovered during the competition, the competition qualification will be cancelled; if a problem is discovered after the competition, the competition results will be cancelled, and the award certificate and prizes will be withdrawn. And announced on the official website of the competition.
(2) Contestants should abide by competition rules, competition venue disciplines, obey the instructions and arrangements of the competition organizing committee, and take good care of the competition venue equipment.
(3) The competition adopts machine marking and a small amount of manual assistance. Contestants need to pay special attention to the form of submitting their answers. You must carefully read the input and output requirements and examples of the question, and do not add unnecessary content at will.
(4) When using Java language, please note that the main class name must be: Main, and the package statement cannot be used.

14th Java group real questions

Summarize

This article is the test focus of the Java direction of the Lanqiao Cup and the real questions of the 14th session.

Guess you like

Origin blog.csdn.net/m0_38139250/article/details/134703295