結果
問題 | No.1664 Unstable f(n) |
ユーザー | bluemegane |
提出日時 | 2021-09-04 09:44:03 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 689 bytes |
コンパイル時間 | 905 ms |
コンパイル使用メモリ | 65,408 KB |
実行使用メモリ | 24,632 KB |
最終ジャッジ日時 | 2023-08-22 16:19:11 |
合計ジャッジ時間 | 6,600 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 55 ms
23,024 KB |
testcase_01 | AC | 57 ms
20,988 KB |
testcase_02 | AC | 56 ms
22,992 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 55 ms
20,940 KB |
testcase_07 | AC | 55 ms
21,056 KB |
testcase_08 | AC | 57 ms
23,112 KB |
testcase_09 | AC | 56 ms
20,920 KB |
testcase_10 | AC | 55 ms
20,972 KB |
testcase_11 | WA | - |
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 | -- | - |
ソースコード
using static System.Math; using System; public class Hello { static void Main() { var n = long.Parse(Console.ReadLine().Trim()); if (n <= 3) Console.WriteLine(n); getAns(n); } static void getAns(long n) { var ans = n + 1; var jmax = (int)(Log10(n) / Log10(2)); for (long i = 2; i * i <= n; i++) { var p = 0; var x = 1L; while (p < jmax) { if (x * i > n) break; x *= i; p++; } var k = n - x; if (k >= 0) ans = Min(ans, i + p + k); } Console.WriteLine(ans); } }