結果

問題 No.164 ちっちゃくないよ!!
ユーザー te-shte-sh
提出日時 2017-02-06 15:43:39
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 592 bytes
コンパイル時間 1,640 ms
コンパイル使用メモリ 152,568 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-03 01:20:34
合計ジャッジ時間 2,660 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 9 ms
4,380 KB
testcase_06 AC 9 ms
4,380 KB
testcase_07 AC 4 ms
4,380 KB
testcase_08 AC 6 ms
4,380 KB
testcase_09 AC 6 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.bigint;    // BigInt
import std.uni;       // unicode

void main()
{
  auto n = readln.chomp.to!size_t;

  auto r = n.iota.map!(_ => readln.chomp).map!calc.fold!min;

  writeln(r);
}

auto calc(string v)
{
  auto b = convertDigit(v.fold!max) + 1;
  return convert(v, b);
}

BigInt convert(string s, int b)
{
  auto r = BigInt(0);
  auto j = BigInt(1);
  foreach (c; s.retro) {
    r += j * convertDigit(c);
    j *= b;
  }
  return r;
}

int convertDigit(dchar c)
{
  return c.isNumber ? c - '0' : c - 'A' + 10;
}

0