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
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int t,x,i,ans,v;
- cin>>t;
- while(t--)
- {
- ans=0;
- cin>>x;
- for(i=0; i*111<=x; i++)
- {
- v=x-(111*i);
- if(v%11==0)
- {
- ans=1;
- break;
- }
- }
- if(ans==1)
- cout<<"YES"<<endl;
- else
- cout<<"NO"<<endl;
- }
- }
No comments