結果

問題 No.164 ちっちゃくないよ!!
ユーザー gemmarogemmaro
提出日時 2020-07-15 13:09:25
言語 Ruby
(3.3.0)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 564 bytes
コンパイル時間 58 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,672 KB
最終ジャッジ日時 2024-05-01 12:32:55
合計ジャッジ時間 1,870 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
12,160 KB
testcase_01 AC 87 ms
12,032 KB
testcase_02 AC 86 ms
12,160 KB
testcase_03 AC 87 ms
12,160 KB
testcase_04 AC 86 ms
12,160 KB
testcase_05 AC 104 ms
12,672 KB
testcase_06 AC 102 ms
12,544 KB
testcase_07 AC 96 ms
12,544 KB
testcase_08 AC 98 ms
12,544 KB
testcase_09 AC 101 ms
12,544 KB
testcase_10 AC 88 ms
12,032 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