Please read the new rule regarding the restriction on the use of AI tools. ×

Contest Editorial
Difference between en16 and en17, changed 3 character(s)
**Hadi & Math**↵

What is the Sum of the numbers from 1 ... n↵

<spoiler summary="hint">↵
excepted_sum = n*(n+1)/2↵
</spoiler>↵

Knowing the actual sum and the excepted sum, how to find the missing sum?↵

<spoiler summary="solution">↵
answer = n*(n+1)/2 &mdash; sum(Array)↵
</spoiler>↵


<spoiler summary="tip">↵
For c++ users use long long, and for java users use long to avoid overflow↵
</spoiler>↵

**Michael And The Easy A**↵

<spoiler summary="hint 1">↵
What is the maximum sum we can obtain if we have even number of negative integers?↵
</spoiler>↵

<spoiler summary="hint 2">↵
What about odd number of negative integers?↵
</spoiler>↵

<spoiler summary="hint 3">↵
What is the maximum number of negative integers we may have in an optimal sequence
  ?
</spoiler>↵

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en21 English Adam_Jardali 2024-09-29 15:21:24 0 (published)
en20 English Adam_Jardali 2024-09-29 15:21:11 6
en19 English Adam_Jardali 2024-09-29 15:20:21 2
en18 English Adam_Jardali 2024-09-29 15:19:51 2
en17 English Adam_Jardali 2024-09-29 15:19:35 3
en16 English Adam_Jardali 2024-09-29 15:18:45 127
en15 English Adam_Jardali 2024-09-29 15:17:28 12
en14 English Adam_Jardali 2024-09-29 15:16:48 10
en13 English Adam_Jardali 2024-09-29 15:16:12 238
en12 English Adam_Jardali 2024-09-29 15:13:04 113
en11 English Adam_Jardali 2024-09-29 15:11:34 11 Tiny change: 'n*(n+1)/2 (-) sum(Array' -> 'n*(n+1)/2 - sum(Array'
en10 English Adam_Jardali 2024-09-29 15:11:19 27 Tiny change: 'n*(n+1)/2 &mdash; sum(Array' -> 'n*(n+1)/2 (-) sum(Array'
en9 English Adam_Jardali 2024-09-29 15:09:57 21
en8 English Adam_Jardali 2024-09-29 15:09:18 5
en7 English Adam_Jardali 2024-09-29 15:08:57 161
en6 English Adam_Jardali 2024-09-29 15:07:22 108
en5 English Adam_Jardali 2024-09-29 15:06:41 0 Tiny change: 'Math**\n\n' -> 'Math**\n\n- What is the Sum of the numbers from 1 ... n'
en4 English Adam_Jardali 2024-09-29 15:06:14 9 Tiny change: 'Math**\n\n' -> 'Math**\n\n- What is the Sum of the numbers from 1 ... n'
en3 English Adam_Jardali 2024-09-29 15:05:53 48 Tiny change: 'Math**\n\n' -> 'Math**\n\n- What is the Sum of the numbers from 1 ... n'
en2 English Adam_Jardali 2024-09-29 15:05:33 45 Tiny change: 'Math**\n\n' -> 'Math**\n\n- What is the Sum of the numbers from 1 ... n'
en1 English Adam_Jardali 2024-09-29 15:02:42 24 Initial revision (saved to drafts)