結果

問題 No.1176 少ない質問
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2023-07-06 22:23:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 391 bytes
コンパイル時間 910 ms
コンパイル使用メモリ 10,668 KB
実行使用メモリ 8,704 KB
最終ジャッジ日時 2023-09-27 23:24:30
合計ジャッジ時間 1,547 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,520 KB
testcase_01 AC 20 ms
8,552 KB
testcase_02 AC 21 ms
8,556 KB
testcase_03 AC 22 ms
8,560 KB
testcase_04 AC 20 ms
8,656 KB
testcase_05 AC 21 ms
8,632 KB
testcase_06 AC 20 ms
8,560 KB
testcase_07 AC 20 ms
8,588 KB
testcase_08 AC 19 ms
8,696 KB
testcase_09 AC 19 ms
8,628 KB
testcase_10 AC 19 ms
8,616 KB
testcase_11 AC 18 ms
8,640 KB
testcase_12 AC 18 ms
8,636 KB
testcase_13 AC 19 ms
8,652 KB
testcase_14 AC 19 ms
8,704 KB
testcase_15 AC 20 ms
8,520 KB
testcase_16 AC 19 ms
8,696 KB
testcase_17 AC 19 ms
8,660 KB
testcase_18 AC 19 ms
8,516 KB
testcase_19 AC 19 ms
8,564 KB
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import maxsize
from collections import deque


a = int(input())

n, m = 2, 1
while n**m < a:
    m += 1

q = deque()
q.append((n, m))

visited = set()
ans = maxsize
while len(q) > 0:
    n, m = q.popleft()
    if n**m >= a and (n, m) not in visited:
        visited.add((n, m))
        ans = min(ans, n * m)
        q.append((n + 1, m - 1))
        q.append((n, m - 1))

print(ans)
0