結果
問題 |
No.1185 完全な3の倍数
|
ユーザー |
|
提出日時 | 2024-05-07 09:02:56 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 138 ms / 2,000 ms |
コード長 | 359 bytes |
コンパイル時間 | 494 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 89,344 KB |
最終ジャッジ日時 | 2024-11-30 00:24:24 |
合計ジャッジ時間 | 5,883 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 39 |
ソースコード
N = int(input()) import sys sys.setrecursionlimit(10**7) def dfs(n): if 100 <= n <= N: nums.append(n) for i in [0, 3, 6, 9]: if n * 10 + i <= N: dfs(n * 10 + i) nums = [] dfs(3) dfs(6) dfs(9) #print(nums) ans = 0 if N <= 100: ans = N // 3 - 10 // 3 else: ans = 100 // 3 - 10 // 3 ans += len(nums) print(ans)