A problem with C++

Правка en1, от SalooP, 2017-04-22 18:03:35

Look at these submissions:

26586468

26586481

They have one different that is using:

for(int c:vec)

instead of:

for(int j=0;j<vec.sz;j++{
    int c = vec[j];
    ...
}

one get Runtime and other one is Accepted.

I think that is happen because I change the size of my vector in the "for" However the size of it will be constant after each step.

Can I anyone explain? Tnks a lot.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en4 Английский SalooP 2017-04-22 22:49:58 1 Tiny change: 'size();j++{\n int' -> 'size();j++){\n int'
en3 Английский SalooP 2017-04-22 18:06:54 4 Tiny change: '=0;j<vec.sz;j++{\n ' -> '=0;j<vec.size();j++{\n '
en2 Английский SalooP 2017-04-22 18:04:54 0 (published)
en1 Английский SalooP 2017-04-22 18:03:35 497 Initial revision (saved to drafts)