Editorial for 1-ден N-ге дейін қосынды
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.
Hint 1.
Барлық сандарды бір-бірлеп қосу тиімсіз, себебі \(N\) өте үлкен болуы мүмкін.
Hint 2.
Бұл қосындыны тек \(N\) арқылы есептейтін арнайы формула бар.
Hint 3.
Формула мынаған ұқсайды:
\(\frac{N \cdot (N + 1)}{2}\)