Untoutiyaumahe 0.0.0

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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/Untoutiyaumahe.rb +24 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7e0b4da768d6e48d2abb2a4108c83edb5719f51e
4
+ data.tar.gz: a1440f6600b0cffc7e771a7dea175b30b37e3562
5
+ SHA512:
6
+ metadata.gz: 9a49bfa4279af14957fdb4c390199431fc1ff1c4191cf7a39e4d36e45b02c20b45e1ff51af42ac62e89a7816172eb5b5897ebbdbd29ff816e6b511db5342606d
7
+ data.tar.gz: b8e0a5fb75f8e0e8ca0e6cd7c677b0441177594e7afbb9cb9282cbe9c79833193f115a88bc658506c6e35212f5c6c84f5fe987da7feb8c146baf4ae03cac59a8
@@ -0,0 +1,24 @@
1
+ class Untoutiyaumahe
2
+
3
+ def self.untoutiyaumahe(num, array)
4
+ sums = array.map do |i|
5
+ array.take(i).inject(:+)
6
+ end
7
+ deltas = sums.map do |i|
8
+ num - i
9
+ end
10
+ positives = deltas.select do |i|
11
+ 0 <= i
12
+ end
13
+ toukentai = positives.size
14
+ hisiri = positives[-1]
15
+ [toukentai, hisiri]
16
+ end
17
+
18
+ def self.inverse_untoutiyaumahe(array, untoutiyaumahe)
19
+ toukentai = untoutiyaumahe[0]
20
+ hisiri = untoutiyaumahe[1]
21
+
22
+ num = array.take(toukentai).inject(:+) + hisiri
23
+ end
24
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: Untoutiyaumahe
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ieremius Inoue Daisuke
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-09-22 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: calc Untoutiyaumahe
14
+ email: hibariyashiki@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/Untoutiyaumahe.rb
20
+ homepage: https://tanukinonegura.com
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.5.2.1
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: calc Untoutiyaumahe
44
+ test_files: []