Editorial for Tổng dươ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.
Authors:
Spoiler Alert
Hint 1
- Duyệt qua từng phần tử \(x \in A[]\)
Khởi tạo \(dem = 0\), \(sum = 0\)
Nếu \(x\) dương \(\Leftrightarrow\) \(x > 0\) thì ta tăng \(dem\) lên 1 và \(sum\) lên \(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à khi \(x\) dương thì tăng tổng \(sum\) và tăng biến đếm \(dem\)
Comments