結果
問題 |
No.1185 完全な3の倍数
|
ユーザー |
|
提出日時 | 2020-08-22 13:49:55 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 250 ms / 2,000 ms |
コード長 | 507 bytes |
コンパイル時間 | 163 ms |
コンパイル使用メモリ | 82,076 KB |
実行使用メモリ | 177,320 KB |
最終ジャッジ日時 | 2024-11-24 09:26:26 |
合計ジャッジ時間 | 4,788 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 39 |
ソースコード
import sys def input(): return sys.stdin.readline().strip() def mapint(): return map(int, input().split()) sys.setrecursionlimit(10**9) N = int(input()) def dfs(idx, string): if idx==length: ret.append(string) return for nx in ['0', '3', '6', '9']: dfs(idx+1, string+nx) if N<=100: print(N//3-3) else: ans = 100//3-3 length = len(str(N)) ret = [] dfs(0, '') for s in ret: n = int(s) if 100<=n<=N: ans += 1 print(ans)