結果
問題 | No.1664 Unstable f(n) |
ユーザー | tenten |
提出日時 | 2021-09-06 08:47:53 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,091 bytes |
コンパイル時間 | 3,045 ms |
コンパイル使用メモリ | 71,184 KB |
実行使用メモリ | 50,712 KB |
最終ジャッジ日時 | 2023-08-24 05:33:06 |
合計ジャッジ時間 | 7,590 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 44 ms
49,376 KB |
testcase_01 | AC | 56 ms
50,712 KB |
testcase_02 | AC | 44 ms
49,292 KB |
testcase_03 | AC | 44 ms
49,360 KB |
testcase_04 | AC | 44 ms
49,380 KB |
testcase_05 | AC | 44 ms
49,156 KB |
testcase_06 | AC | 44 ms
49,328 KB |
testcase_07 | AC | 43 ms
49,044 KB |
testcase_08 | AC | 43 ms
49,040 KB |
testcase_09 | AC | 44 ms
49,232 KB |
testcase_10 | AC | 43 ms
49,308 KB |
testcase_11 | AC | 863 ms
49,708 KB |
testcase_12 | TLE | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
ソースコード
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); long n = sc.nextLong(); long max = n; for (long i = 2; i <= max; i++) { long x = 1; int count = 0; while (n / i >= x) { count++; x *= i; max = Math.min(max, i + count + (n - x)); } } System.out.println(max); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }