tasks_gem 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/tasks/version.rb +1 -1
- data/lib/tasks.rb +4 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e8a6c3f3ce3438643e429617d424b5c59afecab3f31f9c5489c67fa324dee17
|
4
|
+
data.tar.gz: 443580e8cee882e8bce468b9e62e83c1f9ea7d4c97918ee694938ae18cc0fd0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a6aa5a7f13d17d2c40deea2f6a02633eed2defb2658a581681b4faed7f0bdd855a32820c509bac91ae58aece1bad085b5243140106995c080d4555a8e633adc
|
7
|
+
data.tar.gz: c6ca6d91b51ceafd83007bcf280c9158123e7c3275fb3d3377c5ccfebff9a4ea96315eef3406a8fa1cdf07ef47b6dfdb29b2d1a9fdbf6ac410924af3490e2aab
|
data/Gemfile.lock
CHANGED
data/lib/tasks/version.rb
CHANGED
data/lib/tasks.rb
CHANGED
@@ -268,6 +268,7 @@ module Tasks
|
|
268
268
|
array = new_array(quantity: n)
|
269
269
|
sum_array = 0
|
270
270
|
(0..n - 1).each { |i| sum_array += array[i]**(i + 1) }
|
271
|
+
{ array: array, sum: sum_array }
|
271
272
|
end
|
272
273
|
|
273
274
|
def task_325(n:)
|
@@ -410,12 +411,13 @@ module Tasks
|
|
410
411
|
end
|
411
412
|
|
412
413
|
def task_988(horse_num:)
|
413
|
-
|
414
|
+
horse_num = horse_num.to_i
|
415
|
+
horse_num = 1 if (1..3).include? horse_num
|
414
416
|
finish = 500
|
415
417
|
horses_run = []
|
416
418
|
3.times { horses_run.push(rand(1..100)) }
|
417
419
|
while horses_run.max < finish
|
418
|
-
horses_run = horses_num(run: horses_run, horse_num:
|
420
|
+
horses_run = horses_num(run: horses_run, horse_num: horse_num)
|
419
421
|
end
|
420
422
|
horses_run[horse_num - 1] >= finish ? 'Victory!' : 'Try again.'
|
421
423
|
end
|