Editorial for Tổng lẻ
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
- Duyệt qua từng phần tử \(x \in A[]\)
Khởi tạo \(sum = 0\)
Nếu \(x\) lẻ \(\Leftrightarrow\) \(x \equiv 1 (mod\) \(2)\) thì ta tăng \(sum\) lên một đại lượng bằng \(x\)
Hint 2
- Ta có thể không cần lưu mảng [
Online Solving
]
Chỉ cần chạy \(n\) lần nhận phần tử \(x\) và thêm vào tổng \(sum\) khi \(x\) lẻ
Comments