diff options
author | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2016-10-08 20:14:23 +0700 |
---|---|---|
committer | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2016-10-08 20:14:23 +0700 |
commit | 4bc9c7d398bddca1e7ab1072a02b7a22f773cb81 (patch) | |
tree | e454ed05e695d32ae534fb114760a3c2276ca9d4 | |
parent | 2a7bc10f6c011d19fb3b0e73068f7e1a9c30ace0 (diff) | |
download | cp-4bc9c7d398bddca1e7ab1072a02b7a22f773cb81.tar.gz |
Update /r/dailyprogrammer challenge #286 [Easy]
-rw-r--r-- | daily/286easy/README.md (renamed from daily/286easy/problem.md) | 25 | ||||
-rwxr-xr-x | daily/286easy/lairotcaf | bin | 148836 -> 0 bytes | |||
-rw-r--r-- | daily/286easy/lairotcaf.inp | 6 | ||||
-rw-r--r-- | daily/286easy/lairotcaf.o | bin | 4976 -> 0 bytes | |||
-rw-r--r-- | daily/286easy/lairotcaf.out | 6 | ||||
-rw-r--r-- | daily/286easy/problem.html | 25 |
6 files changed, 16 insertions, 46 deletions
diff --git a/daily/286easy/problem.md b/daily/286easy/README.md index 8715cbe..038e44a 100644 --- a/daily/286easy/problem.md +++ b/daily/286easy/README.md @@ -1,39 +1,46 @@ -# Description +# [[2016-10-03] Challenge #286 [Easy] Reverse Factorial](https://www.reddit.com/r/dailyprogrammer/comments/55nior/20161003_challenge_286_easy_reverse_factorial/) -Nearly everyone is familiar with the factorial operator in math. 5! yields 120 because factorial means "multiply successive terms where each are one less than the previous": +## Description + +Nearly everyone is familiar with the factorial operator in math. 5! yields 120 +because factorial means "multiply successive terms where each are one less than +the previous": 5! -> 5 * 4 * 3 * 2 * 1 -> 120 Simple enough. -Now let's reverse it. Could you write a function that tells us that "120" is "5!"? +Now let's reverse it. Could you write a function that tells us that "120" is +"5!"? -Hint: The strategy is pretty straightforward, just divide the term by successively larger terms until you get to "1" as the resultant: +Hint: The strategy is pretty straightforward, just divide the term by +successively larger terms until you get to "1" as the resultant: 120 -> 120/2 -> 60/3 -> 20/4 -> 5/5 -> 1 => 5! -# Sample Input +## Sample Input You'll be given a single integer, one per line. Examples: 120 150 -# Sample Output +## Sample Output -Your program should report what each number is as a factorial, or "NONE" if it's not legitimately a factorial. Examples: +Your program should report what each number is as a factorial, or "NONE" if +it's not legitimately a factorial. Examples: 120 = 5! 150 NONE -# Challenge Input +## Challenge Input 3628800 479001600 6 18 -# Challenge Output +## Challenge Output 3628800 = 10! 479001600 = 12! diff --git a/daily/286easy/lairotcaf b/daily/286easy/lairotcaf deleted file mode 100755 index 68e22b8..0000000 --- a/daily/286easy/lairotcaf +++ /dev/null Binary files differdiff --git a/daily/286easy/lairotcaf.inp b/daily/286easy/lairotcaf.inp deleted file mode 100644 index ea4419c..0000000 --- a/daily/286easy/lairotcaf.inp +++ /dev/null @@ -1,6 +0,0 @@ -3628800 -479001600 -6 -18 -150 -120 diff --git a/daily/286easy/lairotcaf.o b/daily/286easy/lairotcaf.o deleted file mode 100644 index ebc1810..0000000 --- a/daily/286easy/lairotcaf.o +++ /dev/null Binary files differdiff --git a/daily/286easy/lairotcaf.out b/daily/286easy/lairotcaf.out deleted file mode 100644 index 9916cd0..0000000 --- a/daily/286easy/lairotcaf.out +++ /dev/null @@ -1,6 +0,0 @@ -3628800 = 10! -479001600 = 12! -6 = 3! -18 NONE -150 NONE -120 = 5! diff --git a/daily/286easy/problem.html b/daily/286easy/problem.html deleted file mode 100644 index 362cc50..0000000 --- a/daily/286easy/problem.html +++ /dev/null @@ -1,25 +0,0 @@ -<h1 id="description">Description</h1> -<p>Nearly everyone is familiar with the factorial operator in math. 5! yields 120 because factorial means "multiply successive terms where each are one less than the previous":</p> -<pre><code>5! -> 5 * 4 * 3 * 2 * 1 -> 120</code></pre> -<p>Simple enough.</p> -<p>Now let's reverse it. Could you write a function that tells us that "120" is "5!"?</p> -<p>Hint: The strategy is pretty straightforward, just divide the term by successively larger terms until you get to "1" as the resultant:</p> -<pre><code>120 -> 120/2 -> 60/3 -> 20/4 -> 5/5 -> 1 => 5!</code></pre> -<h1 id="sample-input">Sample Input</h1> -<p>You'll be given a single integer, one per line. Examples:</p> -<pre><code>120 -150</code></pre> -<h1 id="sample-output">Sample Output</h1> -<p>Your program should report what each number is as a factorial, or "NONE" if it's not legitimately a factorial. Examples:</p> -<pre><code>120 = 5! -150 NONE</code></pre> -<h1 id="challenge-input">Challenge Input</h1> -<pre><code>3628800 -479001600 -6 -18</code></pre> -<h1 id="challenge-output">Challenge Output</h1> -<pre><code>3628800 = 10! -479001600 = 12! -6 = 3! -18 NONE</code></pre> |