結果

問題 No.164 ちっちゃくないよ!!
ユーザー papinianuspapinianus
提出日時 2016-08-29 14:00:44
言語 PHP
(8.3.4)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 623 bytes
コンパイル時間 1,038 ms
コンパイル使用メモリ 18,300 KB
実行使用メモリ 18,984 KB
最終ジャッジ日時 2023-08-09 01:36:27
合計ジャッジ時間 2,147 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
18,856 KB
testcase_01 AC 15 ms
18,824 KB
testcase_02 AC 14 ms
18,832 KB
testcase_03 AC 14 ms
18,984 KB
testcase_04 AC 15 ms
18,964 KB
testcase_05 AC 24 ms
18,768 KB
testcase_06 AC 24 ms
18,856 KB
testcase_07 AC 19 ms
18,920 KB
testcase_08 AC 20 ms
18,928 KB
testcase_09 AC 21 ms
18,980 KB
testcase_10 AC 15 ms
18,832 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$alpha = "0123456789abcdefghijklmnopqrstuvwxyz";
$n = trim(fgets(STDIN));
$min = gmp_init("0");
for(; $n; $n--) {
    $str = str_split(trim(fgets(STDIN)));
    $std = stripos($alpha, max($str))+1;
    $tmp = arrayToInt($str, $std, $min);
    if(gmp_cmp($min, 0) == 0 || gmp_cmp($tmp, $min) < 0) {$min = $tmp;}
}
echo gmp_strval($min).PHP_EOL;

function arrayToInt($array, $std = 2, $cut) {
    global $alpha;
    $val = 0;
    $base = 1;
    while(!is_null($char = array_pop($array))) {
        $val = gmp_add(gmp_mul(stripos($alpha,$char),$base), $val);
        $base = gmp_mul($base,$std);
    }
    return $val;
}
0