A. Lucky Division
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5,17, 467 are not.

Petya calls a number almost lucky if it could be evenly divided by some lucky number. Help him find out if the given number n is almost lucky.

Input

The single line contains an integer n (1 ≤ n ≤ 1000) — the number that needs to be checked.

Output

In the only line print "YES" (without the quotes), if number n is almost lucky. Otherwise, print "NO" (without the quotes).

Examples
input
47
output
YES
input
16
output
YES
input
78
output
NO
Note

Note that all lucky numbers are almost lucky as any number is evenly divisible by itself.

In the first sample 47 is a lucky number. In the second sample 16 is divisible by 4.

【代码】:

#include<bits/stdc++.h>
using namespace std; #define LL long long
using namespace std;
int n;
int fun(int n)
{
while(n)
{
if(n%!= && n%!=)
return ;
n/=;
}
return ;
}
int main()
{
int n,f;
ios::sync_with_stdio(false);
while(cin>>n)
{
f=;//
for(int i=;i<=n;i++)
{
if(n%i== && fun(i))
{
f=;
}
}
if(f) puts("YES");
else puts("NO");
}
return ;
}

枚举

Codeforces Beta Round #91 (Div. 2 Only) A. Lucky Division【暴力/判断是不是幸运数字4,7的倍数】的更多相关文章

  1. codeforces水题100道 第十二题 Codeforces Beta Round #91 (Div. 2 Only) A. Lucky Division (brute force)

    题目链接:http://www.codeforces.com/problemset/problem/122/A题意:判断一个数是否能被一个lucky number整除,一个lucky number是一 ...

  2. Codeforces Beta Round #91 (Div. 1 Only) E. Lucky Array

    E. Lucky Array Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers w ...

  3. Codeforces Beta Round #91 (Div. 1 Only) E. Lucky Array 分块

    E. Lucky Array time limit per test 4 seconds memory limit per test 256 megabytes input standard inpu ...

  4. Codeforces Beta Round #97 (Div. 1) B. Rectangle and Square 暴力

    B. Rectangle and Square 题目连接: http://codeforces.com/contest/135/problem/B Description Little Petya v ...

  5. Codeforces Beta Round #92 (Div. 1 Only) A. Prime Permutation 暴力

    A. Prime Permutation 题目连接: http://www.codeforces.com/contest/123/problem/A Description You are given ...

  6. Codeforces Beta Round #4 (Div. 2 Only) A. Watermelon【暴力/数学/只有偶数才能分解为两个偶数】

    time limit per test 1 second memory limit per test 64 megabytes input standard input output standard ...

  7. Codeforces Beta Round #77 (Div. 2 Only) A. Football【字符串/判断是否存在连续7个0或7个1】

    A. Football time limit per test 2 seconds memory limit per test 256 megabytes input standard input o ...

  8. Codeforces Beta Round #80 (Div. 2 Only)【ABCD】

    Codeforces Beta Round #80 (Div. 2 Only) A Blackjack1 题意 一共52张扑克,A代表1或者11,2-10表示自己的数字,其他都表示10 现在你已经有一 ...

  9. Codeforces Beta Round #83 (Div. 1 Only)题解【ABCD】

    Codeforces Beta Round #83 (Div. 1 Only) A. Dorm Water Supply 题意 给你一个n点m边的图,保证每个点的入度和出度最多为1 如果这个点入度为0 ...

随机推荐

  1. js valueOf和toString方法

    JavaScript原生提供一个Object对象,所有其他对象都继承自这个对象,Object对象有valueOf和valueOf方法,所以所有JS数据类型都继承了这两种方法.   valueOf:返回 ...

  2. 利用socket.io构建一个聊天室

    利用socket.io来构建一个聊天室,输入自己的id和消息,所有的访问用户都可以看到,类似于群聊. socket.io 这里只用来做一个简单的聊天室,官网也有例子,很容易就做出来了.其实主要用的东西 ...

  3. 珍藏版 Python 开发工程师面试试题

    珍藏版 Python 开发工程师面试试题 说明:不拿到几家公司的offer,那就是卑鄙的浪费 一.Python_基础语法 1.可变与不可变类型: 2.浅拷贝与深拷贝的实现方式.区别:deepcopy如 ...

  4. python中字符串是特殊的列表

    for x in range(20): print 'fizz'[x%3*4::]+'buzz'[x%5*4::]or x 这个是由 Jeff Atwood推广的一个编程练习叫FizzBuzz,问题如 ...

  5. STL之queue&stack使用简介

       queue 队列也是一个线性存储表,与后进先出的堆栈不同,元素数据的插入在表的一端进行,在另一端删除,从而构成了一个先进先出(First In First Out) 表.插入一端称为队尾,删除一 ...

  6. hdu 1574 RP问题 01背包的变形

    hdu 1574 RP问题 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1574 分析:01背包的变形. RP可能为负,所以这里分两种情况处理一下就好 ...

  7. LINQ to Entities 不识别方法“System.Guid Parse(System.String)”,因此该方法无法转换为存储表达式。

    LINQ to Entities 不识别方法"System.Guid Parse(System.String)",因此该方法无法转换为存储表达式. linq 中不能转换类型

  8. js实现封装和继承

    封装(模拟对象) http://www.ruanyifeng.com/blog/2010/05/object-oriented_javascript_encapsulation.html 继承 htt ...

  9. DP———2.最大m子序列和

    Max Sum Plus Plus Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others ...

  10. Topcoder SRM 604 div1题解

    CTSC考完跑了过来日常TC--- Easy(250pts): 题目大意:有个机器人,一开始的位置在(0,0),第k个回合可以向四个方向移动3^k的距离(不能不动),问是否可以到达(x,y),数据满足 ...