Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main(){
- long long n;
- cin >> n;
- for(long long i=4;i<=1000000000;i++)
- {
- string s=to_string(i);
- int count=0,count2=0;
- bool idk=true;
- for(int j=0;j<s.size();j++)
- {
- if(s[j]=='4')
- {
- count++;
- }
- else if(s[j]=='7')
- {
- count2++;
- }
- else
- {
- idk=false;
- break;
- }
- }
- if((i>=n) and (count==count2) and (idk))
- {
- cout << i;
- return 0;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement