heres how its gonna work, guys. there is only one choice for the language here: C++. No ANSI-C, no C#, no Java, no fucking Haskell. C++. your programs are going to accept input from the standard IO, and are going to output to the standard IO. i will then take your source code, compile it using g++, and do a pipelined input and output, such as:
g++ -c yoursource.cpp
g++ -o yourprogram yoursource.o
yourprogram < myinputfile.inp > anoutputfile.oup
if your output does not match my output EXACTLY, it is wrong. i am doing this in the same way that any programming competition judge would do it. you will not know what test cases are in my input file, and if your program is wrong, you will recieve nothing more from me than "wrong answer".
you will post your source code in its entirety to pastebin, or a similar site. i will take that source, copy it into a text file, and run it. do not post the link to your source in this thread, send it to me via PM. i will then post in THIS thread that attempt #N by X was accepted/rejected.
presentational errors will not be forgiven. if i ask for an output of "Hello World" and your program gives me "Hello world", it is wrong. without further ado, here comes...
Programming Challenge #2: sieve cycle
the sieve of eratosthenes is a common method of creating a naive list of prime numbers. a list is made of numbers is counted through, and an entry that is a multiple of a previous entry is discounted as a composite number.
you will be given two numbers, and it is your job to output these numbers, followed by the number of primes found between them, inclusively (meaning, including the endpoints). example input and output files can be found below.
if there are M primes between A and B, then an input of:
A B
will return
A B M
http://pastebin.ca/raw/680078
http://pastebin.ca/raw/680079