How to make a program in the "Tricks" algorithm contest

Source: Internet
Author: User

In the course of the contest, a pair-pat program can help you to eliminate many errors,

If you're worried about the positive solution being written by some small data card,

We usually write an alignment procedure to check the correctness of the positive solution,

See if the positive solution is the same as the output of violence through a large amount of data.

We first come up with a brute force program that we wrote that could be timed out but guaranteed to be absolutely correct, called Bf.exe,

And then take out the positive solutions we're writing to detect, called Std.exe,

Then we write a random data generator, which is used to generate a set of self-made random data to detect output, called Gen.exe,

Then we'll write a procedure that takes advantage of Windows batch processing.

Create a new document called Check.bat in the root directory of your program,

Open the batch file with the editing software and add the following code:

> Data. inch  < data.  in > std.out < data.  in > Bf.  out FC Std.  out BF.  out if 1 Goto Looppause goto Loop

The first line of echo off function is to turn off the excess display, so that it can only let the PAT program display the information.

The second loop acts as a loop, and the following actions are performed.

The greater-than sign represents output redirection, which allows output from the running program to be output in a specific file.

The less-than sign represents an input redirect that allows a running program to read input information from a specific file.

The six-row FC operation represents a comparison of two files, and the results are displayed in the console.

Line seventh means that if you don't make an error, return to the second loop for the next pair of beats.

Line eighth, pause is the operation of Sysem ("pause") in C language.

The Nineth line can be followed by a second round of the clap after pause .

Once you have finished writing this batch program you can save the exit run to the PAT.

I wish you all a good result in the competition!

How to make a program in the "Tricks" algorithm contest

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.