結果
| 問題 |
No.3316 Make 81181819 with only 0,1,or 8
|
| コンテスト | |
| ユーザー |
nikoro256
|
| 提出日時 | 2025-10-31 22:11:43 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,120 bytes |
| コンパイル時間 | 441 ms |
| コンパイル使用メモリ | 82,776 KB |
| 実行使用メモリ | 77,512 KB |
| 最終ジャッジ日時 | 2025-10-31 22:11:49 |
| 合計ジャッジ時間 | 5,820 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 7 WA * 15 |
ソースコード
T=int(input())
n=81181819
for _ in range(T):
N=int(input())
d = n - N
digit = 30
dp = [[None]*digit for _ in range(9)]
dp[0][0] = []
for i in range(8):
for j in range(digit):
if dp[i][j] == None:
continue
for k in range(digit):
nxt = k*10 + d//(10**i)%10 - j
if nxt < 0:
break
dp_d = dp[i][j][::]
t = 0
while nxt > 0:
if nxt >= 8:
nxt-=8
add = 8
else:
nxt-=1
add = 1
if t >= len(dp_d):
dp_d.append(0)
dp_d[t]+=(add*(10**i))
t+=1
if dp[i+1][k] == None or len(dp[i+1][k]) > len(dp_d):
dp[i+1][k] = dp_d
ans = dp[-1][0]
for a in ans:
for c in "2345679":
if c in str(a):
assert 0==1
ans.sort()
print(len(ans))
for a in ans:
print(a)
nikoro256