Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Codeforces Round 122A
- #include <iostream>
- using namespace std;
- int Happy(int n)
- {
- double q=1, z;
- int ans=0;
- while(q!=1001)
- {
- z=n/q;
- if(z == int(z))
- {
- if(q==4 || q==7 || q==44 || q==47 || q==74 || q==77 || q==444 || q==447 || q==474 || q==477 || q==744 || q==747 || q==774 || q==777)
- {
- ans=1;
- }
- }
- q++;
- }
- if(ans==1){cout<<"YES";}else{cout<<"NO";}
- return ans;
- }
- int main()
- {
- int n;
- cin >> n;
- if(n==4 || n==7 || n==44 || n==47 || n==74 || n==77 || n==444 || n==447 || n==474 || n==477 || n==744 || n==747 || n==774 || n==777)
- {
- cout << "YES";
- }
- else
- {
- Happy(n);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment