Codeforces-SolutionsA/Codes/122 A - Lucky Division/122A.cpp

42 lines
722 B
C++
Raw Normal View History

2023-06-25 18:05:42 +08:00
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void solve()
{
int n;
cin>>n;
for(int num = 1; num <= 1000; ++num)
{
int r,temp;
temp = num;
bool lucky = true;
while(temp > 0)
{
r = temp % 10;
temp = temp / 10;
if(r != 4 && r != 7)
{
lucky = false;
break;
}
}
if(lucky && n%num==0)
{
cout<<"YES"<<endl;
return;
}
}
cout<<"NO"<<endl;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int TC = 1;
//cin >> TC;
//cin.ignore();
while (TC--) solve();
}