Advertisement
outoftime

System modeling (python)

Feb 10th, 2013
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. def init(a, val):
  2. i = 5
  3. while i > -1:
  4. a[i] = val % 10
  5. val /= 10
  6. i -= 1
  7.  
  8. def check(a):
  9. return sum(a[3:]) == 10 and sum(a[:3]) == 10
  10.  
  11. def main():
  12. a, res = [0] * 6, 0
  13. for i in range(0,10**6):
  14. init(a,i)
  15. res += check(a)
  16. print res
  17.  
  18. if __name__ == '__main__':
  19. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement