Help Needed !!!

Правка en2, от Please_Read, 2022-07-13 12:45:51

Official problem and code link : https://mirror.codeforces.com/blog/entry/91195

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;
    }

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Please_Read 2022-07-13 12:45:51 15 Tiny change: 'ntry/91195#comment-931355\n\nin th' -> 'ntry/91195\n\nin th'
en1 Английский Please_Read 2022-07-13 12:45:11 580 Initial revision (published)