結果

問題 No.2784 繰り上がりなし十進和
ユーザー ゼット
提出日時 2024-06-14 22:05:38
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 514 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 82,224 KB
実行使用メモリ 133,832 KB
最終ジャッジ日時 2024-06-14 22:05:43
合計ジャッジ時間 4,144 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 TLE * 1 -- * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

L=set()
K=[]
for i in range(6):
  s=input()
  K.append(s)
def f(a,b):
  c=''
  for i in range(6):
    x=int(a[i])+int(b[i])
    x%=10
    c+=str(x)
  return c
dp=[0]*1000001
from collections import deque
S=deque()
for s in K:
  x=0
  for i in range(6):
    x+=int(s[-(i+1)])*10**i
  if dp[x]==0:
    dp[x]=1
    S.append(s)
while S:
  h=S.pop()
  for i in range(6):
    s=K[i]
    b=f(h,s)
    x=0
    for j in range(6):
      x+=int(b[-(j+1)])*10**j
    if dp[x]==0:
      dp[x]=1
      S.append(b)
print(sum(dp))
0