Блог пользователя Please_Read

Автор Please_Read, история, 23 месяца назад, По-английски

Official problem and code link : https://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;
    }
  • Проголосовать: нравится
  • -12
  • Проголосовать: не нравится