Help Needed !!!

Revision en1, by Please_Read, 2022-07-13 12:45:11

Official problem and code link : https://codeforces.net/blog/entry/91195#comment-931355

in the solution of problem B (1526B — I Hate 1111), the author only run the loop for 20 times, how it is guaranteed that the answer will be found within 20 iterations?

because if x is too large, like 10e8, after 20 iterations it will still remain tense to 1e8

please help me to understand this

i am taking about this loop :

rep(x,0,20){
       if (n%11==0){
         cout<<"YES"<<endl;
         goto done;
       }

       n-=111;
       if (n<0) break;
    }

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Please_Read 2022-07-13 12:45:51 15 Tiny change: 'ntry/91195#comment-931355\n\nin th' -> 'ntry/91195\n\nin th'
en1 English Please_Read 2022-07-13 12:45:11 580 Initial revision (published)