結果
| 問題 |
No.1185 完全な3の倍数
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-22 14:38:54 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 359 bytes |
| コンパイル時間 | 118 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 313,728 KB |
| 最終ジャッジ日時 | 2024-10-15 08:54:23 |
| 合計ジャッジ時間 | 10,382 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 8 TLE * 1 -- * 30 |
ソースコード
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())