Số phong phú
View as PDF
Submit solution
Points:
0.06 (partial)
Time limit:
0.38s
Memory limit:
256M
Input:
stdin
Output:
stdout
Problem source:
Problem types
Allowed languages
C, C++, Go, Java, Kotlin, Pascal, PyPy, Python, Rust, Scratch
Trong số học, số phong phú là các số mà tổng các ước số của số đó (không kể chính nó) lớn hơn số đó. Ví dụ, số ~12~ có tổng các ước số (không kể ~12)~ là ~1 + 2 + 3 + 4 + 6 = 16 > 12~. Do đó ~12~ là một số phong phú.
Bạn hãy lập trình đếm xem có bao nhiêu số phong phú trong đoạn ~[L~, ~R]~.
Input
- Gồm ~2~ số ~L~, ~R~ ~(1 \le L \le R \le 10^{5})~
Output
- Gồm ~1~ số nguyên duy nhất là số số phong phú trong đoạn ~[L~, ~R]~.
Giới hạn
- Có ~50\%~ số test có ~1 \le L \le R \le 10^{3}~
Sample Input
1 50
Sample Output
9
Note
- Từ ~1~ đến ~50~ có ~9~ số phong phú là: ~12~, ~18~, ~20~, ~24~, ~30~, ~36~, ~40~, ~42~, ~48~
Comments
1 đấm AC
thực hiện như sàng số nguyên tố, không khác gì đâu:))
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
mọi người dùng sàng ước nhá:D def sub(n): result = [1] * (n + 1)
for i in range(2, n//2 + 1): for j in range(i * 2, n + 1, i):result[j] += i return result
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
em hỏi :))
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.