結果
| 問題 |
No.3316 Make 81181819 with only 0,1,or 8
|
| コンテスト | |
| ユーザー |
dokukuma
|
| 提出日時 | 2025-10-31 21:27:30 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,247 bytes |
| コンパイル時間 | 472 ms |
| コンパイル使用メモリ | 82,168 KB |
| 実行使用メモリ | 78,192 KB |
| 最終ジャッジ日時 | 2025-10-31 21:27:37 |
| 合計ジャッジ時間 | 6,002 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 1 WA * 21 |
ソースコード
import sys, time, random, heapq, math, itertools, copy
from collections import deque, Counter, defaultdict
#from sortedcontainers import SortedSet, SortedList
from bisect import bisect, bisect_left, bisect_right
import heapq as hq
from functools import cache, cmp_to_key
def debug(*x):print('debug:',*x, file=sys.stderr)
#sys.setrecursionlimit(300000)
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 61 - 1
mod = 998244353
dir = [(0, 1), (0, -1), (1, 0), (-1, 0)]
T = ii()
all_018 = []
tes = "abcd"
tes += "e"
tes[-1]
def dfs(i:list):
global all_018
if i:
value = int("".join(i))
if value > 81181819:
return 0
all_018.append(value)
if i:
i.append("0")
dfs(i)
i.pop(-1)
i.append("1")
dfs(i)
i.pop(-1)
i.append("8")
dfs(i)
i.pop(-1)
dfs([])
all_018.sort()
L = len(all_018)
for _ in range(T):
N = ii()
rest = 81181819 - N
ans = []
for i in range(L-1,-1,-1):
while all_018[i] <= rest:
rest -= all_018[i]
ans.append(all_018[i])
print(len(ans))
for i in range(len(ans)):
print(ans[i])
dokukuma