This weekend, the instructor started watching the Netflix television series, Atypical, which is about Sam, an 18-year-old on the autism spectrum, and his family.
One of the symptoms of autism is repetitive behaviors:
Repetitive behaviors can take the form of intense preoccupations, or obsessions. These extreme interests can prove all the more unusual for their content (e.g. fans, vacuum cleaners or toilets) or depth of knowledge (e.g. knowing and repeating astonishingly detailed information about Thomas the Tank Engine or astronomy). Older children and adults with autism may develop tremendous interest in numbers, symbols, dates or science topics.
In the show Atypical, for instance, Sam is obsessed with Antarctica and penguins and will freely tell people all about his favorite subjects (much to the chagrin of his friends and family) such as:
And all I can do is sit and twiddle, which is what I call my self-stimulatory behavior, when I flick a pencil against a rubber band at a certain frequency and think about all the things that I could never do, like research penguins in Antarctica or have a girlfriend. I don't know. I'd like to go to Antarctica. It's quiet there except in the rookeries, where the penguins breed.
In this programming challenging, however, let's assume Sam is obsessed with
numbers instead of penguins and wants to apply his intense researching
skills into numbers with atypical division. This means that Sam wants
to find all the pairs of 5
-digit numbers that use the digits 0
through
9
once each, such that the first number divided by the second is equal to
some integer N
, where N
is between 2
and 79
(inclusive). That is,
abcde / fghij = N
where each letter represents a different digit. The first digit of one of
the numerals is allowed to be 0
.
Each line of input consists of a valid integer N
. An input of 0
terminates the program (no output should be displayed for it).
61 62 0
The program should display ALL pairs of numerals that match the description above. The numerators should be sorted by increasing numerator and denominator and displayed in the following format:
XXXXX / XXXXX = N XXXXX / XXXXX = N ...
If there are no pairs of numerals satisfying the atypical division condition, then the program should display: "There are no solutions for N".
Separate the output for tow different values of N
by a blank line.
There are no solutions for 61. 79546 / 01283 = 62 94736 / 01528 = 62
This is based on the Division problem on the UVa Online Judge.
To submit your work, follow the same procedure you used for Reading 00:
$ cd path/to/cse-30872-fa17-assignments # Go to assignments repository $ git checkout master # Make sure we are on master $ git pull --rebase # Pull any changes from GitLab $ git checkout -b challenge07 # Create and checkout challenge07 branch $ $EDITOR challenge07/program.cpp # Edit your code $ git add challenge07/program.cpp # Stage your changes $ git commit -m "challenge07: done" # Commit your changes $ git push -u origin challenge07 # Send changes to GitLab
To check your code, you can use the .scripts/submit.py
script or curl:
$ .scripts/submit.py Submitting challenge07 assignment ... Submitting challenge07 code ... Result Success Score 6.00 $ curl -F source=@challenge07/program.cpp https://dredd.h4x0r.space/code/cse-30872-fa17/challenge07 {"score": 6, "result": "Success"}
Once you have commited your work and pushed it to GitLab, member to create a merge request. Refer to the Reading 04 TA List to determine your corresponding TA for the merge request.