ログインしてください。
提出 #43432250
ソースコード 拡げる
t = int(input())
for _ in range(t):
n, k = map(int, input().split())
if k%2 != n%2:
print('No')
continue
m = 0
while 3**m < n:
m += 1
if 3**m > n:
m -= 1
times = n // 3**m
# print(m, times)
cur = n - times * 3**m
while cur % 3**m:
m -= 1
times += cur // 3**m
print('Yes' if times <= k else 'No')
提出情報
| 提出日時 | |
|---|---|
| 問題 | A - Ternary Decomposition |
| ユーザ | VioletVal |
| 言語 | PyPy3 (7.3.0) |
| 得点 | 0 |
| コード長 | 396 Byte |
| 結果 | WA |
| 実行時間 | 474 ms |
| メモリ | 79572 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 0 / 300 | ||||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | sample-01.txt |
| All | in-01.txt, in-02.txt, in-03.txt, in-04.txt, in-05.txt, in-06.txt, sample-01.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| in-01.txt | WA | 429 ms | 76272 KiB |
| in-02.txt | AC | 467 ms | 74336 KiB |
| in-03.txt | WA | 467 ms | 74892 KiB |
| in-04.txt | WA | 474 ms | 76376 KiB |
| in-05.txt | WA | 464 ms | 79572 KiB |
| in-06.txt | WA | 419 ms | 74740 KiB |
| sample-01.txt | AC | 49 ms | 61736 KiB |