結果
問題 |
No.1664 Unstable f(n)
|
ユーザー |
|
提出日時 | 2021-09-04 09:58:51 |
言語 | C# (.NET 8.0.404) |
結果 |
WA
|
実行時間 | - |
コード長 | 766 bytes |
コンパイル時間 | 8,554 ms |
コンパイル使用メモリ | 170,936 KB |
実行使用メモリ | 60,928 KB |
最終ジャッジ日時 | 2024-12-17 16:51:06 |
合計ジャッジ時間 | 40,874 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 WA * 3 TLE * 9 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (88 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Numerics; namespace yukicoder { class Program { const int intMax = 1000000000; const long longMax = 2000000000000000000; static void Main(string[] args) { long n = long.Parse(Console.ReadLine()); long ans = longMax; if(n < 4) Console.WriteLine(n); for(long j = 2; j <= Math.Log2(n); j++) { long i = (long)Math.Pow(n, 1 / j); while(Math.Pow(i + 1, j) <= n) i++; long k = n - (long)Math.Pow(i, j); ans = Math.Min(ans, i + j + k); } Console.WriteLine(ans); } } }