Weird behaviour while using string.length() in cpp

Правка en5, от Always_WA14, 2025-01-01 16:31:44

Hi codeforces community, I was solving 1820B - JoJo's Incredible Adventures and I got WA when I used s.length()*s.length(), but got AC when I used n*n (but n is the same as s.length()).

Is this supposed to happen?

299256114 is the AC code and 299255008 is the other one. Check the second "else if" statement at the end.

Теги cpp

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en6 Английский Always_WA14 2025-01-01 16:33:34 0 (published)
en5 Английский Always_WA14 2025-01-01 16:31:44 6
en4 Английский Always_WA14 2025-01-01 16:31:20 4
en3 Английский Always_WA14 2025-01-01 16:30:55 23 Reverted to en1
en2 Английский Always_WA14 2025-01-01 16:30:02 23
en1 Английский Always_WA14 2025-01-01 16:29:10 378 Initial revision (saved to drafts)