1 er problème : SmallBrain
Smallbrain Numbers
A smallbrain number is an N-digit integer whose value is the sum of the digits raised to the Nth power. For example, 371 is a smallbrain number since
3^3 + 7^3 + 1^3 = 27 + 343 + 1 = 371.
Problem Description: Write a threaded program to compute all smallbrain numbers within a given integer range. Input to the application will be two integers on the command line corresponding to the lower and upper bounds of the range to be explored. The output of the application will be a list of all smallbrain numbers discovered within the input range.
Input Description: The input to the program will be two positive integers on the application’s command line. These integers are the lower and upper bounds (inclusive) of the range to search for smallbrain numbers. Each input value can be represented by a 64-bit integer.
Output Description: The output to be generated by the application is a sorted list of all smallbrain numbers found within the input range. Each smallbrain number printed should be on a single line. All output will be printed to stdout.
Input command line example: ./smallbrain 200 99999
Output example:
Smallbrain numbers between 200 and 99999:
370
371
407
1634
8208
9474
54748
92727
93084
Timing: The total execution time of the application will be used for scoring. For most accurate timing results, submission codes would include timing code to measure and print total execution time to stdout, otherwise an external stopwatch will be used to measure the entire execution time.
Partager