Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define loop(i,b,e) for(int i=b;i<=e;i++)
- #define reloop(i,e,b) for(int i=e;i>=b;i--)
- int holes(int n) {
- int h=0;
- if (n == 0)
- return 1;
- while (n != 0) {
- if (n%10 == 0 || n%10 == 6 || n%10 == 9)
- h += 1;
- if (n%10 == 8)
- h += 2;
- n /=10;
- }
- return h;
- }
- int a,b,maxh,ans;
- int main() {
- cin >> a >> b;
- loop(i,a,b) {
- if (maxh < holes(i)) {
- ans = i;
- maxh = holes(i);
- }
- }
- cout << ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement