結果
| 問題 |
No.897 compαctree
|
| コンテスト | |
| ユーザー |
liny_tail
|
| 提出日時 | 2023-01-03 17:34:58 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 38 ms / 2,000 ms |
| コード長 | 276 bytes |
| コンパイル時間 | 245 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-11-27 02:17:35 |
| 合計ジャッジ時間 | 1,328 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 |
ソースコード
Q = int(input().strip())
def calc(N, K):
N -= 1
if K == 1:
return N
else:
cnt = 0
while N > 0:
cnt += 1
N -= K**cnt
return cnt
for i in range(Q):
N, K = map(int, input().strip().split(' '))
ans = calc(N, K)
print(ans)
liny_tail