Bedao Mini Contest 08 - PAIRS

View as PDF

Submit solution


Points: 0.60 (partial)
Time limit: 1.0s
Memory limit: 256M
Input: stdin
Output: stdout

Author:
Problem type
Allowed languages
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch

Cho hai số nguyên dương ~n~ và ~m~, hãy đếm số lượng cặp số nguyên ~(a,b)~ thỏa mãn điều kiện sau:

  • ~a\times b \leq m~
  • ~1\leq a < b \leq n~
  • ~a\times b~ là số chính phương

Input

  • Dòng đầu chứa số nguyên dương ~n~ (~1 \le n \le 10^{7}~).
  • Dòng thứ hai chứa số nguyên dương ~m~ (~1 \le m \le 10^{14}~).

Output

  • Một số nguyên duy nhất là số lượng cặp số thỏa mãn.

Sample Input

4
4

Sample Output

1

Subtask

  • ~20\%~ số test có ~n \le 3\,000~
  • ~20\%~ số test tiếp theo có ~n \le 10^5, m \le 10^6~
  • ~30\%~ số test tiếp theo có ~n \le 10^6~
  • ~30\%~ số test còn lại không có điều kiện gì thêm

Giải thích

Cặp số duy nhất thỏa mãn là ~a=1,b=4~


Comments

Please read the guidelines before commenting.


There are no comments at the moment.