First job _ Documentation

Source: Internet
Author: User

Calculators-engineering documents

A Input and format

1. Data size

The input for this document is based on the following requirements:

(1) Since they are primary school students, we assume that they do not calculate more than 1 billion of the numbers.

(2) Since it is an examination question, then there will be no more than 1 billion questions.

In other words n, r∈int;

2. Format requirements:

The output format for this document is:

(1) When the test is produced, the output is n lines, each line is a calculation number, a period and a space, followed by a calculation. A calculation contains an equal sign. There is a space before and after the arithmetic sign and the equals sign. The remaining symbols are not. The answer output is n lines, each line is a calculation number, a period, and a space, followed by an answer.

(2) The output folder of the question is Exercises.txt, and the output of the answer is Answer.txt.

(3) When comparing the answer, receive console instruction –e xxx–a xxx. XXX is the answer file for question papers and comparisons. Read in to the end of the file, each line read into the format of the calculation number, a period and a space, followed by a calculation. A calculation contains an equal sign. There is a space before and after the arithmetic sign and the equals sign. The remaining symbols are not. When you read the answer, each line is a calculation number, a period, and a space, followed by an answer.

(4) Output a file, for the wrong information. The file is Grade.txt, which is the correct question number and the wrong question number, separated by a comma and a space between each of the two numbers.

Two Program Structure

The general relationship of the program, because there is no related software, first draw a drawing.

Three Concrete Implementation Method

    1. The parentheses of the program

The parentheses are randomly generated to ensure that no illegal input is created. It is possible that the precedence of the formula in parentheses is high, the parentheses do not change the order, and the order of calculation and the result of the calculation may be changed.

    1. Generation of formulas

The method of generating a calculation is that of the numerator and denominator of all the reciprocal primes. Range is within range, and when range is too large, range is reduced to 20000.

    1. Calculation of formulas

To generate infix expressions, the work method in the compute class changes the infix expression to the suffix expression, then presses the stack to calculate.

    1. Answer output

Read in the string format, processing strings, get the number stack and symbols, according to the suffix expression to calculate, and finally in the stack of the first number is the result.

    1. Answer format

The answer turns into a string output in string format.

First job _ Documentation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.