Editorial for Số chính phương
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.
Spoiler Alert
Hint 1
- Số chính phương \(n\) là số có dạng \(n = x ^ 2\) với \(x \in Z\)
Duyệt qua mọi \(0 \leq x \leq n\) xem có tồn tại \(x ^ 2 = n\) hay không
Hint 2
- Số chính phương \(n\) là số có dạng \(\sqrt n \in N\)
Kiểm tra xem \(\sqrt n\) có thuộc tập số tự nhiên hay không
Hint 3
- Với \(x \in Z\) thì \(x = \lfloor x \rfloor = \lceil x \rceil = [x]\)
Kiểm tra xem \(\sqrt n = [\sqrt n]\) thì \(n\) là số chính phương
Comments