-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_Lucky_Division.cpp
More file actions
36 lines (34 loc) · 892 Bytes
/
A_Lucky_Division.cpp
File metadata and controls
36 lines (34 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(NULL), cout.tie(NULL)
#define REP(i, start, end) for(auto i = start; i < end; i++)
//#define FORJ(start, end) for(auto j = start; j < end; j++)
bool isLucky(int temp){
int digits =0, count = 0;
while (temp != 0){
if(temp%10 == 4 || temp %10 == 7) count++;
digits++;
temp = temp/10;
}
//cout << "digits = " << digits <<"count = " <<count;
if(digits == count ) return true;
else return false;
}
int main(){
FASTIO;
int n;
cin >> n;
int temp = n, digits = 0, count= 0;
if(isLucky(n)){
cout <<"YES";
return 0;
}
REP(i, 2, n){
if(n % i == 0 && isLucky(i)){
cout <<"YES";
return 0;
}
}
cout<<"NO";
return 0;
}