728x90
https://www.acmicpc.net/problem/1526
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = n; i >= 4; i--) {
int numerator = i;
int flag = false;
while (numerator != 0) {
if (numerator % 10 == 4 || numerator % 10 == 7) {
numerator /= 10;
}
else {
flag = true;
break;
}
}
if (!flag) {
cout << i;
return 0;
}
}
return 0;
}
728x90
'알고리즘 문제' 카테고리의 다른 글
[백준] 4690번 완전 세제곱 (0) | 2020.02.12 |
---|---|
[백준] 1592번 영식이와 친구들 (0) | 2020.02.12 |
[백준] 9237번 이장님 초대 (0) | 2020.02.12 |
[백준] 1991번 트리 순회 (0) | 2020.02.12 |
[백준] 6376번 e 계산 (0) | 2020.02.11 |