結果

問題 No.164 ちっちゃくないよ!!
ユーザー gemmarogemmaro
提出日時 2020-07-15 13:09:25
言語 Ruby
(3.3.0)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 564 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 11,356 KB
実行使用メモリ 15,644 KB
最終ジャッジ日時 2023-08-13 22:55:09
合計ジャッジ時間 2,523 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
15,288 KB
testcase_01 AC 80 ms
15,208 KB
testcase_02 AC 81 ms
15,164 KB
testcase_03 AC 79 ms
15,128 KB
testcase_04 AC 80 ms
15,012 KB
testcase_05 AC 94 ms
15,644 KB
testcase_06 AC 93 ms
15,564 KB
testcase_07 AC 87 ms
15,504 KB
testcase_08 AC 90 ms
15,248 KB
testcase_09 AC 91 ms
15,256 KB
testcase_10 AC 83 ms
15,288 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# frozen_string_literal: true

class Integer
  def to_number
    self >= 48 && self <= 57 ? self - 48 : self - 55
  end
end

class Array
  def to_integer(base)
    size
      .times
      .to_a
      .reverse
      .map { base**_1 }
      .zip(self)
      .filter { _1 && _2 }
      .map { _1 * _2 }
      .sum
  end
end

class String
  def parse
    codepoints = chars.map { _1.ord.to_number }
    base = codepoints.max + 1
    codepoints.to_integer(base)
  end
end

def solve
  V.map { _1.parse }.min
end

N = gets.to_i
V = N.times.map { gets.chomp }

puts solve
0