結果

問題 No.1462 最弱WEAKER
ユーザー c-yan
提出日時 2021-04-02 21:37:36
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 268 bytes
コンパイル時間 109 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 21,504 KB
最終ジャッジ日時 2024-12-23 18:36:25
合計ジャッジ時間 10,598 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 RE * 1 TLE * 1
other AC * 2 RE * 14 TLE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import log

N = int(input())

def f(n):
    if n == 0:
        return True
    a = int(log(n, 3))
    for i in range(a + 1):
        if f(n - 3 ** i):
            continue
        return True
    return False

if f(N):
    print('YES')
else:
    print('NO')
0