fork download
  1. class Solution:
  2. def numberOfMatches(self, n: int) -> int:
  3. matches = 0
  4. while n > 1:
  5. temp = n // 2
  6. matches += temp
  7. if n != 1:
  8. n = temp + ( 1 if n % 2 == 1 else 0)
  9.  
  10. return matches
Success #stdin #stdout 0.13s 14168KB
stdin
Standard input is empty
stdout
Standard output is empty