結果

問題 No.1185 完全な3の倍数
ユーザー hir355
提出日時 2020-08-22 13:36:13
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 468 ms / 2,000 ms
コード長 375 bytes
コンパイル時間 1,329 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 29,740 KB
最終ジャッジ日時 2024-11-24 09:21:21
合計ジャッジ時間 11,276 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

l = [15, 24, 42, 51, 18, 27, 45, 54, 72, 81, 12, 21, 84, 75, 57, 48, 87, 78]
n = int(input())
s = [0]
st = set()
while s:
    p = s.pop()
    if p in st or p > n:
        continue
    l.append(p)
    st.add(p)
    s.append(p * 10)
    s.append(p * 10 + 3)
    s.append(p * 10 + 6)
    s.append(p * 10 + 9)
ans = 0
for x in l:
    if 10 <= x <= n:
        ans += 1
print(ans)
0