Editorial for Bedao Regular Contest 03 - 3 NUMBERS
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.
Author:
Không mất tính tổng quát, giả sử là ~a \le b \le c~.
Từ đây ta suy ra ~a \times a \times a \le n <=> a \le \sqrt[3]{n}~
Và từ ~a \times b \times c \le n~ ta suy ra ~b \times c \le \frac{n}{a} (1)~
Lại có ~a~ là số nguyên dương nên ~a \ge 1~ suy ra ~\frac{1}{a} \le 1 (2)~
Từ ~(1)~ và ~(2)~ suy ra ~b \times b \le b \times c \le \frac{n}{a} \le n~
~=> b \le \sqrt{n}~
Từ đây, ta tính được số bộ ~3~ số ~(a,b,c)~ với ~a \le b \le c~ và ~a \times b \times c \le n~
Gọi kết quả vừa tính được là ~x~
Kết quả cuối cùng bằng ~x \times 6~ rồi trừ đi số lượng số bộ ~(a,b,c)~ bị lặp lại (tức là số bộ số mà ~a=b~ hoặc ~b=c~ hoặc ~c=a~ hoặc ~a=b=c~)
Comments