Objective
Exams have been tested dozens of sets, has not been to shoot, greedy problem or can not write out, or manually create a few data shot.
Today the mood is not very good, does not want to write the question, is everywhere to pick up I thought slightly looks a bit also good back a bit of pat.
The package is A+B code and data generation code, you can try it. Random data generation compared to water, I haven't studied it yet, but I can use it.
I almost knocked 5 times before I memorized this pair of shots ...
Code-to-PAT program
Library functions cannot be saved
#include <cstdio>#include<cstdlib>#include<ctime>intMain () {Longs,t; while(1) {System ("CLS"); Do{System ("Data > Try.in");//Data Generation Programs=clock (); System ("a < try.in > Try1.out");//Positive Solutiont=clock (); System ("B < try.in > Try2.out");//violence if(System ("FC Try1.out try2.out > Nul")) Break; Elseprintf"AC time:%ldms\n", Ts); } while(1); printf ("WA time:%ldms\n", Ts); System ("FC Try1.out Try2.out"); System ("Pause > Nul"); }}
Positive solution
#include <iostream>usingnamespace std; int Main () { int A, b; CIN>>a>>b; cout<<a+b<<Endl; return 0 ;}
Violence
#include <iostream>usingnamespace std; int Main () { int A, b; CIN>>a>>b; while (b--) a++; cout<<a<<Endl; return 0 ;}
Random Data generation
#include <iostream>#include<ctime>#include<cstdlib>using namespace std; int Main () { srand ((unsigned) time (0)); int b; A=rand (); b=rand (); cout<<a<<'<<b<<Endl; return 0 ;}
Operating result AC effect
WA effect
"Template" to Pat Program