結果
| 問題 | No.820 Power of Two |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-03 00:21:07 |
| 言語 | Standard ML (MLton 20210117) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 582 bytes |
| 記録 | |
| コンパイル時間 | 3,392 ms |
| コンパイル使用メモリ | 689,148 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-12-03 00:21:15 |
| 合計ジャッジ時間 | 4,370 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
fun readInt () =
valOf (TextIO.scanStream (Int.scan StringCvt.DEC) TextIO.stdIn)
fun intPow (x, y) =
let
fun loop n =
if n = 0 then 1
else x * loop (n - 1)
in
loop y
end
fun findAns i base limit =
if limit < i * base then 0
else 1 + findAns (i + 1) base limit
val () =
let
val n = readInt ()
val k = readInt ()
val ans =
if k = 0 then intPow (2, n)
else findAns 1 (intPow (2, k)) (intPow (2, n))
in
print (Int.toString ans ^ "\n")
end