結果
問題 |
No.1185 完全な3の倍数
|
ユーザー |
|
提出日時 | 2020-08-22 14:39:53 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,333 ms / 2,000 ms |
コード長 | 359 bytes |
コンパイル時間 | 176 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 441,644 KB |
最終ジャッジ日時 | 2024-11-24 09:30:30 |
合計ジャッジ時間 | 11,861 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 39 |
ソースコード
from collections import deque def solve(): N = int(input()) if N<=100: return N//3-3 ans = 30 d = deque(['0','3','6','9']) while len(d): s = d.popleft() if s[0]!='0': n = int(s) if n>100 and n<=N: ans += 1 if len(s)<=len(str(N)): for l in ['0','3','6','9']: d.append(l+s) return ans print(solve())