It has to print the first N abundant numbers to STDOUT, one number per line (and nothing else!), and then exit successfully. You can assume that the value N is a positive integer at most 1000000.
Your program has to be written in standard C++, using the standard version C++11. Your program can use all functions in the C++ standard library (including all functions in the C standard library), but no other libraries. It is fine to use plain C, as long as your program compiles fine with a C++ compiler. Your program has to be written 100% by yourself. You cannot work together with other students, or use any code that you find online.
Your solution has to be a single C++ file, named
abundant.cc, and it has to compile fine with GCC version 5.4, which is installed in the classroom computers. Test your code on the classroom computers and make sure the following command compiles it successfully:
g++ -std=c++11 -Wall -Wextra -O3 abundant.cc -o abundant
Then make sure it works correctly (here “$” represents the Linux command prompt); here are some examples:
$ ./abundant 1 12 $ ./abundant 2 12 18 $ ./abundant 5 12 18 20 24 30 $ ./abundant 10000 | tail -1 40350 $ ./abundant 5 | md5sum f85c2aa82cd806cb71bcec038fe5a4c5 - $ ./abundant 10000 | md5sum 9063302ee3b8bb6ab5d3a4cbf64c17f7 -
The performance does not matter; a slow but correct solution is sufficient (as long as it is not ridiculously inefficient).
You will submit your solution online in A+ system. Log on to A+, enroll there for the course CS-E4580, and you should find the prerequisite test there. The test opens on 3 April 2017, and closes on 14 April 2017, at noon.
The system will ask you to enter the following information:
The system will automatically verify your submission. If all goes well, you can just wait and relax.
In a few days, you should receive an invitation by email from GitHub to join the course organization. After that, read the instructions on the GitHub workflow to get started with the course work.
Use the channel #prereq in our Slack chat if you need any help with the prerequisite test.