Confusion in using accumulate function

Правка en2, от chirag2505, 2021-08-09 20:45:41

Hello Codeforces!

I have a doubt in today contest problem A :(https://codeforces.net/contest/1557/problem/A)

I submitted solution in which I have used accumulate function to get sum of all elements of vector but it gave me WA.

And finally I got AC in which I find sum by traversing all elements.

Is there any difference in both methods to get sum of all elements of vector?

Here are the links of my both submissions :

125393659 — WA

125396830 — AC

Please help me to find out the error in code(using accumulate function).

Thanks in advance:)

Теги #help, #doubt, #codingcontest

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский chirag2505 2021-08-30 14:07:00 20 Tiny change: 'dvance:)\n' -> 'dvance:)\n\n**UPD : Resolved**'
en2 Английский chirag2505 2021-08-09 20:45:41 8 Tiny change: 'nI have a serious doubt in ' -> 'nI have a doubt in '
en1 Английский chirag2505 2021-08-09 20:35:49 666 Initial revision (published)