Guest User

Untitled

a guest
Sep 10th, 2020
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. import functools
  2.  
  3. counted = 0
  4.  
  5.  
  6. @functools.lru_cache(maxsize=None)
  7. def multiply(a: int, b: int):
  8.     return a * b
  9.  
  10.  
  11. n, k = map(int, input().split())
  12. n += 1
  13. half_n = n // 2
  14.  
  15. for a in range(half_n):
  16.     for b in range(n):
  17.         product = multiply(a, b)
  18.  
  19.         if product >= k:
  20.             if product == k:
  21.                 counted += 1
  22.             break
  23.  
  24.  
  25. for b in range(half_n, n):
  26.     for a in range(n):
  27.         product = multiply(a, b)
  28.  
  29.         if product >= k:
  30.             if product == k:
  31.                 counted += 1
  32.             break
  33.  
  34. print(counted)
  35.  
Advertisement
Add Comment
Please, Sign In to add comment