Advertisement
Saleh127

Untitled

Apr 24th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int a,b,t,c,d,e,f,i,j,k,l;
  6. cin>>t;
  7. while(t--)
  8. {
  9. cin>>a;
  10. while(1)
  11. {
  12. b=0;
  13. c=a;
  14. while(c>0)
  15. {
  16. if(b==0 && c%3==2) b=1;
  17. c=c/3;
  18. }
  19. if(b==0) break;
  20. a++;
  21. }
  22. cout<<a<<endl;
  23. }
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement