B - Lucky Division
Problem description
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.
解题思路:幸运数字只由4和7组成。题目要求判断输入的数字n是否可以整除这些幸运数字中的某一个,如果可以为"YES",否则为"NO"。幸运数字就先打好表,其最大值不超过1000即可,简单水过!
AC代码:
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,obj[14]={,,,,,,,,,,,,,};
bool flag=false;cin>>n;
for(int i=;i<;++i)
if(n%obj[i]==){flag=true;break;}
if(flag)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return ;
}
B - Lucky Division的更多相关文章
- Codeforces Beta Round #91 (Div. 2 Only) A. Lucky Division【暴力/判断是不是幸运数字4,7的倍数】
A. Lucky Division time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...
- 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是一 ...
- codeforcess水题100道
之所以在codeforces上找这100道水题的原因是为了巩固我对最近学的编程语言的掌握程度. 找的方式在codeforces上的PROBLEMSET中过的题最多的那些题里面出现的最前面的10个题型, ...
- lucky 的 时光助理(2)
lucky小姐说:昨天晚上他喝醉了,发消息说他想我了,说他后悔了. 我很惊讶. 我问lucky:你们很久都没有联系, 突然说... 你怎么想. 没错,'他'就是lucky的前男友. lucky看着我, ...
- lucky 的 时光助理
2017年的lucky小姐,厌倦了现在的工作,她觉得这些的工作对于她而言不具备挑战性,她在迷茫春节过后该如何选择, 这里是距她走出校门整整一年的时光. lucky小姐从开发走向了实施,目的是想周游这个 ...
- python from __future__ import division
1.在python2 中导入未来的支持的语言特征中division(精确除法),即from __future__ import division ,当我们在程序中没有导入该特征时,"/&qu ...
- [LeetCode] Evaluate Division 求除法表达式的值
Equations are given in the format A / B = k, where A and B are variables represented as strings, and ...
- ZOJ3944 People Counting ZOJ3939 The Lucky Week (模拟)
ZOJ3944 People Counting ZOJ3939 The Lucky Week 1.PeopleConting 题意:照片上有很多个人,用矩阵里的字符表示.一个人如下: .O. /|\ ...
- 关于分工的思考 (Thoughts on Division of Labor)
Did you ever have the feeling that adding people doesn't help in software development? Did you ever ...
随机推荐
- CAD动态绘制多段线(com接口)
主要用到函数说明: _DMxDrawX::DrawLine 绘制一个直线.详细说明如下: 参数 说明 DOUBLE dX1 直线的开始点x坐标 DOUBLE dY1 直线的开始点y坐标 DOUBLE ...
- 跳转语句(break、continue)
break语句 在switch条件语句和循环语句中都可以使用break语句.当它出现在switch条件语句中时,作用是终止某个case并跳出switch结构. 当它出现在循环语句中,作用是跳出循环语句 ...
- git clone下载代码,中途断掉怎么办?
问题如下: 解决办法: 1)运行以下命令进行clone $ git clone --recursive https:xxxxxx 2)进入项目根目录,继续下载 $ cd eigen-git-mirro ...
- btrfs基础
btrfs文件系统简介 btrfs文件系统:技术预览版(Centos7) Btrfs(B-tree.Butter FS.Better FS),GPL授权,Orale2007提出是想用来取代Ext文 ...
- eas之列表界面写脚本时如何写sql
var easNames = JavaImporter();easNames.importPackage(Packages.com.kingdee.bos.dao.query);with(easNam ...
- vue-cli3 中的环境变量
官方文档是这样写的: src同名文件夹下的建立 .env.[model] 配置文件 // mode:production development ... 载入的变量会对vue-cli-service ...
- 7-11 社交网络图中结点的“重要性”计算 (30 分)(Dijkstra算法)
题意: 思路:对每个输入的点跑一遍dijkstra算法,然后对这个点到所有点的距离求和按公式输出就可以了. (这次尝试了用数组模拟链表来做最短路问题,刷新了自己对最短路的理解) 这里构造链表的过程我 ...
- 解决Scrapy抓取中文网页保存为json文件时中文不显示而是显示unicode的问题
注意:此方法跟之前保存成json文件的写法有少许不同之处,注意区分 情境再现: 使用scrapy抓取中文网页,得到的数据类型是unicode,在控制台输出的话也是显示unicode,如下所示 {'au ...
- 获取springbean的几种方式
首先我说一下我遇到的问题,再项目初始化时候,spring容器初始化前要执行的操作中使用到了bean去做一些增删改查操作,这样做是不能自己使用springbean的数据源去操作的,所以需要动态获取spr ...
- Windows编译PHP7.2拓展
转载请注明文章出处:https://tlanyan.me/windows-co... 准备工作 https://github.com/Microsoft/...下载PHP-SDK(在右边的" ...