Linux next to the beat template

Source: Internet
Author: User

Windows version Portal:

Tinkering with a half-day noilinux, is almost to understand, will probably use noilinux brush questions more.

Data generators (as is the case with Windows)

1#include <bits/stdc++.h>2 using namespacestd;3 #defineRandom (A, B) ((a) +rand ()% ((b)-(a) +1))4 5 StringStream SS;6 7 intMainintargcChar*argv[])8 { 9     intSeed=Time (NULL);Ten     if(ARGC)//If there are parameters One     { A ss.clear (); -ss<<argv[1]; -ss>>seed;//convert parameters to integers to assign to seed the     } - Srand (seed); -     //The above is a random number initialization, do not modify -     //Random (A, B) to generate a [a, b] integer +  -     //Write your own data below to generate code, write according to test instructions +printf"1\n"); A     intn=Ten; at     intM=random (1, -); -printf"%d%d\n", n,m); -      for(intI=0; I<n; ++i) -     { -printf"%d", Random (0, M)); -     } inprintf"\ n"); -     return 0; to}

The PAT procedure

1#!/bin/Bash2  while true; Do3./rand $RANDOM > Data.txt//Data Generators4./std < Data.txt > Out1.txt//Positive Solution5./my < Data.txt > Out2.txt//you write the correctness of the unknown program6     ifdiff out1.txt Out2.txt;7 Echo AC8     Else9 Echo WATenExit0 One     fi ADone

Save the file as an. sh suffix (take for example), and then put three programs in one directory.

When using the first ctrl+alt+t open the terminal, and then enter the CD your file directory (right-click File properties can see the path, all into the case, all the same, note here to all the English path, otherwise unrecognized), enter.

Then enter SH sh.test, enter.

This time on the shooting began to run, if the output of two programs are not different, you will see a lot of lines AC, detect the difference when the beat will stop, you can see in the terminal two programs output the content, in the directory of the can find the wrong set of data.

Pat is still very practical, suggest back down, to the examination room and other passwords when you can first knock out, each problem first write violence and then think positive solution, and then take a shot on the stable more.

Linux next to the beat template

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.