Weird behaviour while using string.length() in cpp

Revision en6, by Always_WA14, 2025-01-01 16:33:34

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.

Tags cpp

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en6 English Always_WA14 2025-01-01 16:33:34 0 (published)
en5 English Always_WA14 2025-01-01 16:31:44 6
en4 English Always_WA14 2025-01-01 16:31:20 4
en3 English Always_WA14 2025-01-01 16:30:55 23 Reverted to en1
en2 English Always_WA14 2025-01-01 16:30:02 23
en1 English Always_WA14 2025-01-01 16:29:10 378 Initial revision (saved to drafts)