結果
問題 | No.164 ちっちゃくないよ!! |
ユーザー | くわい |
提出日時 | 2015-09-24 23:33:11 |
言語 | Scala(Beta) (3.4.0) |
結果 |
AC
|
実行時間 | 1,135 ms / 2,000 ms |
コード長 | 702 bytes |
コンパイル時間 | 11,331 ms |
コンパイル使用メモリ | 260,872 KB |
実行使用メモリ | 64,024 KB |
最終ジャッジ日時 | 2023-09-11 13:21:30 |
合計ジャッジ時間 | 24,730 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 977 ms
63,108 KB |
testcase_01 | AC | 977 ms
63,204 KB |
testcase_02 | AC | 973 ms
63,212 KB |
testcase_03 | AC | 981 ms
63,528 KB |
testcase_04 | AC | 980 ms
63,380 KB |
testcase_05 | AC | 1,130 ms
64,024 KB |
testcase_06 | AC | 1,135 ms
64,020 KB |
testcase_07 | AC | 1,022 ms
63,708 KB |
testcase_08 | AC | 1,126 ms
64,008 KB |
testcase_09 | AC | 1,128 ms
63,876 KB |
testcase_10 | AC | 982 ms
63,244 KB |
ソースコード
import java.util.Scanner object Problem164 { def charToLongValue(c: Char): Long = { c match { case x if x < 58 => x.asDigit // [0-9] -> 0..9 case x => x - 65 + 10 // [a-z] -> 10..35 } } def calcDecimalValue(s: String): Long = { val longs = s.map(charToLongValue) val decimal = longs.max + 1 // 0-indexの最大数値を進数に変換 longs.foldLeft(0L)((a, b) => a * decimal + b) } def proc(numbers: Seq[String]): Long = { numbers.map(calcDecimalValue).min } def main(args: Array[String]): Unit = { val sc = new Scanner(System.in) val n = sc.next.toInt val v = Seq.fill(n)(sc.next) val result = proc(v) println(result) } }