結果
問題 | No.1176 少ない質問 |
ユーザー |
![]() |
提出日時 | 2025-03-20 21:16:52 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 39 ms / 1,000 ms |
コード長 | 822 bytes |
コンパイル時間 | 159 ms |
コンパイル使用メモリ | 82,728 KB |
実行使用メモリ | 54,424 KB |
最終ジャッジ日時 | 2025-03-20 21:17:42 |
合計ジャッジ時間 | 1,776 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
A = int(input())min_nm = float('inf')# Consider M from 1 to 100 to cover larger values that might yield smaller productsfor M in range(1, 101):# Determine the minimum N such that N^M >= A using binary searchleft, right = 1, 1# Expand right until right^M >= Awhile True:current = pow(right, M)if current < A:left = rightright *= 2else:break# Binary search between left and right to find the smallest Nlow, high = left, rightanswer = rightwhile low <= high:mid = (low + high) // 2val = pow(mid, M)if val >= A:answer = midhigh = mid - 1else:low = mid + 1nm = answer * Mif nm < min_nm:min_nm = nmprint(min_nm)