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 ...
随机推荐
- Redis学习总结(1)——Redis内存数据库详细教程
1.redis是什么 2.redis的作者何许人也 3.谁在使用redis 4.学会安装redis 5.学会启动redis 6.使用redis客户端 7.redis数据结构 – 简介 8.redis数 ...
- noip模拟赛 fateice-string
题目背景 Aldnoah ——火星上超古代文明留下的能量源,承认初代火星移民雷伊·雷加利亚博士(即后来的薇瑟帝国初代皇帝)为正统继承者,启动因子融入皇族的遗传因子中,只有皇族天生具有Aldnoah的启 ...
- [bzoj2989]数列_KD-Tree_旋转坐标系
数列 bzoj-2989 题目大意:题目链接. 注释:略. 想法:显然,我们用x和a[x]两个值建立笛卡尔坐标系. 两个点之间的距离为曼哈顿距离. 修改操作就是插入... 查询操作就是查询一个点周围的 ...
- gap lock/next-key lock浅析 Basic-Paxos协议日志同步应用
http://www.cnblogs.com/renolei/p/4673842.html 当InnoDB在判断行锁是否冲突的时候, 除了最基本的IS/IX/S/X锁的冲突判断意外, InnoDB还将 ...
- iOS 基础类解析 - NSData、NSMutableData
iOS 基础类解析 - NSData.NSMutableData 太阳火神的漂亮人生 (http://blog.csdn.net/opengl_es) 本文遵循"署名-非商业用途-保持一致& ...
- [Android]Fragment源代码分析(三) 事务
Fragment管理中,不得不谈到的就是它的事务管理,它的事务管理写的很的出彩.我们先引入一个简单经常使用的Fragment事务管理代码片段: FragmentTransaction ft = thi ...
- 关于isset的一点说明
作者:zhanhailiang 日期:2014-10-08 今天遇到一个非常奇怪的bug,測试例如以下: <? php $a = 'abc'; var_dump(isset($a['code'] ...
- 持续集成(CI)工具------Hudson/Jenkins(Continuous Integration)安装与配置具体解释
本文同意转载.但请标明出处:http://blog.csdn.net/wanghantong/article/40985653/, 版权全部 文章概述: 一. 描写叙述了持续集成工具Hudson的安装 ...
- springboot配置文件加载位置
springboot 启动会扫描以下位置的application.properties或者application.yml文件作为Spring boot的默认配置文件 –file:./config/ – ...
- HDU 3718 Similarity(KM最大匹配)
HDU 3718 Similarity 题目链接 题意:给定一个标准答案字符串,然后以下每一行给一个串.要求把字符一种相应一种,要求匹配尽量多 思路:显然的KM最大匹配问题,位置相应的字符连边权值+1 ...