結果
| 問題 |
No.3236 累乗数大好きbot
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-08-15 21:39:37 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,298 bytes |
| コンパイル時間 | 8,345 ms |
| コンパイル使用メモリ | 171,048 KB |
| 実行使用メモリ | 47,780 KB |
| 最終ジャッジ日時 | 2025-08-15 21:40:14 |
| 合計ジャッジ時間 | 19,299 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 1 WA * 5 TLE * 1 -- * 24 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (106 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
#nullable enable
#region
var _input = Array.Empty<string>();
var _iter = 0;
string String()
{
while (_iter >= _input.Length) (_input, _iter) = (Console.ReadLine()!.Split(' '), 0);
return _input[_iter++];
}
T I<T>() where T : IParsable<T> => T.Parse(String(), null);
#endregion
T[] Range<T>(int n, Func<T> F) => Enumerable.Range(0, n).Select(_ => F()).ToArray();
static long? SafePower(long x, int p)
{
var res = 1L;
while (p > 0)
{
if ((p & 1) > 0)
{
if (res >= long.MaxValue / x) return null;
res *= x;
}
if (x >= long.MaxValue / x) return null;
x *= x;
p >>= 1;
}
return res;
}
long Run()
{
var n = I<long>();
for (var i = 40; i >= 2; i--)
{
var pass = 0L;
var fail = n;
while (fail - pass > 1)
{
var middle = (fail + pass) >> 1;
var next = SafePower(middle, i);
if (next.HasValue && next.Value <= n) pass = middle;
else fail = middle;
}
var k = SafePower(pass, i)!.Value;
if (k == n) return i;
}
return 1;
}
string Join<T>(IEnumerable<T> values, bool ws = false) => string.Join(ws ? " " : Environment.NewLine, values);
Console.WriteLine(Join(Range(I<int>(), Run)));