更改

添加164字节 、 2021年11月2日 (二) 20:54
第24行: 第24行:  
         repres[x] = find_repre(repres[x])
 
         repres[x] = find_repre(repres[x])
 
         return repres[x]
 
         return repres[x]
 +
</syntaxhighlight>
 +
 +
简化为
 +
<syntaxhighlight lang=python>
 +
def find_repr(x):
 +
    if repres[x] != x:
 +
        repres[x] = find_repre(repres[x])
 +
    return repres[x]
 
</syntaxhighlight>
 
</syntaxhighlight>