結果

問題 No.1185 完全な3の倍数
ユーザー qumazaki
提出日時 2020-09-12 02:24:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 330 bytes
コンパイル時間 500 ms
コンパイル使用メモリ 82,156 KB
実行使用メモリ 80,256 KB
最終ジャッジ日時 2024-12-29 15:47:54
合計ジャッジ時間 4,110 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

n = int(input())
ans = min(100,n)//3 - 10//3

d = deque()
for i in [3,6,9]:
    for j in [0,3,6,9]:
        d.append(i*10+j)

while(True):
    i = d.popleft()
    for j in [0,3,6,9]:
        x = i*10+j
        if(x > n):
            print(ans)
            exit()
        ans += 1
        d.append(x)
0