Class: Atcoder148A::Function

Inherits:
Object
  • Object
show all
Defined in:
lib/atcoder_148_a.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(a, b) ⇒ Function

Returns a new instance of Function.

Raises:



13
14
15
16
17
18
# File 'lib/atcoder_148_a.rb', line 13

def initialize(a ,b)
  @a = a
  @b = b

  raise Error.new('invalid arguments') if ([1, 2, 3] & [@a, @b]).length == 0
end

Instance Attribute Details

#aObject (readonly)

Returns the value of attribute a.



11
12
13
# File 'lib/atcoder_148_a.rb', line 11

def a
  @a
end

#bObject (readonly)

Returns the value of attribute b.



11
12
13
# File 'lib/atcoder_148_a.rb', line 11

def b
  @b
end

Instance Method Details

#solveObject



20
21
22
# File 'lib/atcoder_148_a.rb', line 20

def solve
  ([1, 2, 3] - [@a, @b]).first
end