Weird behaviour while using string.length() in cpp
Difference between en5 and en6, changed 0 character(s)
Hi codeforces community,↵
I was solving [problem:1820B] 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?↵


[submission:299256114] is the AC code and [submission:299255008] is the other one. Check the second "else if" statement at the end. ↵

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)