11
правок
Изменения
псевдокод
<tex> count(v) = \left \{
\begin{array}{ll}
d[v], & w[v]=''true'' \\
\sum\limits_{c}count(c), & w[v]=false
\end{array}
sum += '''count'''(g, c)
d[v] = sum
w[v] = ''true''
'''return''' sum
'''countPaths'''(g, s, t)
d[s] = 1
w[s] = '''true'''
answer = '''count'''(t)
'''return''' answer