Codeforces 1526B. I Hate 1111 Solution

 ///La ilaha illellahu muhammadur rasulullah

///******Bismillahir-Rahmanir-Rahim******///

///Abul Hasnat  Tonmoy

///Department of CSE,23rd batch

    ///Islamic University,Bangladesh

    1. #include <bits/stdc++.h>
    2. using namespace std;
    3. int main()
    4. {
    5. int t,x,i,ans,v;
    6. cin>>t;
    7. while(t--)
    8. {
    9. ans=0;
    10. cin>>x;
    11. for(i=0; i*111<=x; i++)
    12. {
    13. v=x-(111*i);
    14. if(v%11==0)
    15. {
    16. ans=1;
    17. break;
    18. }
    19.  
    20. }
    21. if(ans==1)
    22. cout<<"YES"<<endl;
    23. else
    24. cout<<"NO"<<endl;
    25. }
    26. }
    27.  

    No comments

    Most View Post

    Recent post

    RESTful APIs with CRUD Operations in Laravel 12| (2025)

      RESTful APIs serve as the foundation of modern web development. They follow a set of rules called Representational State Transfer (REST) t...

    Powered by Blogger.