結果
問題 |
No.897 compαctree
|
ユーザー |
![]() |
提出日時 | 2021-05-27 15:28:39 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 669 bytes |
コンパイル時間 | 2,165 ms |
コンパイル使用メモリ | 109,392 KB |
実行使用メモリ | 26,256 KB |
最終ジャッジ日時 | 2024-11-06 09:35:45 |
合計ジャッジ時間 | 3,274 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 8 WA * 5 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; public class Hello { static void Main() { var q = int.Parse(Console.ReadLine().Trim()); while (q-- > 0) { string[] line = Console.ReadLine().Trim().Split(' '); var n = int.Parse(line[0]); long k = int.Parse(line[1]); if (k == 1) Console.WriteLine(n - 1); else getAns(n, k); } } static void getAns(int n, long k) { var a = k * k; var p = 2; while (true) { var w = (a - 1) / (k - 1); if (w > n) { Console.WriteLine(p - 1); return; } a *= k; p++; } } }