結果

問題 No.164 ちっちゃくないよ!!
ユーザー yuppe19 😺yuppe19 😺
提出日時 2015-05-01 11:45:13
言語 Nim
(2.0.2)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,200 bytes
コンパイル時間 819 ms
コンパイル使用メモリ 56,868 KB
最終ジャッジ日時 2023-09-11 11:13:32
合計ジャッジ時間 1,315 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
/home/judge/data/code/Main.nim(17, 18) Error: type mismatch: got <int>
but expected one of:
proc `<`(x, y: int): bool
  first type mismatch at position: 2
  missing parameter: y
proc `<`(x, y: int64): bool
  first type mismatch at position: 2
  missing parameter: y
20 other mismatching symbols have been suppressed; compile with --showAllMismatches:on to see them

expression: <exp

ソースコード

diff #

import strutils, sequtils, math, sets

proc `**`*(base: int, exp: int): int64 =
    var base: int64 = base.int64
    var exp:  int64 = exp.int64
    result = int64(1)
    while exp != 0:
        if (exp and 1) != 0:
            result *= base
        exp = exp shr 1
        base *= base

proc mypow64*(base: int, exp: int): int64 =
    var base: int64 = base.int64
    var exp:  int   = exp
    result = 1.int64
    for i in 0.. <exp:
        result *= base

proc mypow*(base: int, exp: int): int =
    var (base, exp) = (base, exp)
    result = 1
    for i in 0.. <exp:
        result *= base

###
const
    mydigits = toSeq('0'..'9') & toSeq('A'..'Z') #echo toSeq(Digits) (ΦωΦ)<書けない!

var
    n = stdin.readLine.parseInt
    v = newSeq[string](n)
    lag :int64 = int64.high

for i in 0.. <n:
    v[i] = stdin.readLine

for line in v:
    var shinho = 0
    for c in line:
        var p = mydigits.find(c) + 1
        shinho = max(shinho, p)
    var tmp = int64(0)
    for i, c in line:
        var p = mydigits.find(c)
        tmp += mypow64(shinho, (line.len - i - 1)) * p
#        tmp += (shinho ** (line.len - i - 1)) * p # (ΦωΦ)<無理!
    lag = min(lag, tmp)

echo lag
0