Editorial for HSG THPT Hải Phòng 2023 - Bài 1
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Nhận xét: khi ta có ~N = a \times b~ thì ~min(a, b) \le \sqrt{N}~
Vì thế ta chỉ cần duyệt qua tất cả các số từ ~i~, ~(1 \le i \le \sqrt{N})~
Khi ~N~ ~\vdots~ ~i~:
- Nếu ~i \ne \sqrt{N}~, ta có ~2~ ước là ~i~ và ~\frac{N}{i}~.
- Nếu ~i = \sqrt{N}~, ta chỉ tính ~1~ ước là ~i~.
Comments