Advertisement
Guest User

Untitled

a guest
Aug 4th, 2021
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6. long long n;
  7. cin >> n;
  8. for(long long i=4;i<=1000000000;i++)
  9. {
  10. string s=to_string(i);
  11. int count=0,count2=0;
  12. bool idk=true;
  13. for(int j=0;j<s.size();j++)
  14. {
  15. if(s[j]=='4')
  16. {
  17. count++;
  18. }
  19. else if(s[j]=='7')
  20. {
  21. count2++;
  22. }
  23. else
  24. {
  25. idk=false;
  26. break;
  27. }
  28. }
  29. if((i>=n) and (count==count2) and (idk))
  30. {
  31. cout << i;
  32. return 0;
  33. }
  34. }
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement