HUST 1600 Lucky Numbers
暴力打表。
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
using namespace std; long long a[];
long long L, R;
int tot; void dfs(long long num, int len)
{
if (len > ) return;
if (num>=&&num<=&&num % == ) a[tot++] = num;
dfs(num * + , len + );
dfs(num * + , len + );
} void init()
{
tot = ;
dfs(, );
dfs(, );
} int main()
{
init();
while (~scanf("%lld%lld", &L, &R))
{
long long ans = ;
for (int i = ; i < tot; i++)
if (a[i] >= L&&a[i] <= R) ans++;
printf("%lld\n", ans);
}
return ;
}
HUST 1600 Lucky Numbers的更多相关文章
- HDU 5676 ztr loves lucky numbers (模拟)
ztr loves lucky numbers 题目链接: http://acm.hust.edu.cn/vjudge/contest/121332#problem/I Description ztr ...
- codeforces 630C Lucky Numbers
C. Lucky Numbers time limit per test 0.5 seconds memory limit per test 64 megabytes input standard i ...
- hdu 5676 ztr loves lucky numbers(dfs+离线)
Problem Description ztr loves lucky numbers. Everybody knows that positive integers are lucky if the ...
- codeforces 630C - Lucky Numbers 递推思路
630C - Lucky Numbers 题目大意: 给定数字位数,且这个数字只能由7和8组成,问有多少种组合的可能性 思路: 假设为1位,只有7和8:两位的时候,除了77,78,87,88之外还哇哦 ...
- hdu 5676 ztr loves lucky numbers 打表+二分
ztr loves lucky numbers Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/ ...
- ZCMU 2177 Lucky Numbers (easy)
传送门: http://acm.zcmu.edu.cn/JudgeOnline/problem.php?id=2177 2177: Lucky Numbers (easy) 时间限制: 2 Sec ...
- hdu-5676 ztr loves lucky numbers(乱搞题)
题目链接: ztr loves lucky numbers Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K ( ...
- C - Lucky Numbers (easy)
Problem description Petya loves lucky numbers. Everybody knows that positive integers are lucky if t ...
- Codeforces Round #160 (Div. 2)---A. Roma and Lucky Numbers
Roma and Lucky Numbers time limit per test 1 second memory limit per test 256 megabytes input standa ...
随机推荐
- db2数据导出导入
C:\Users\yexuxia>set db2instance=TCASHMAN C:\Users\yexuxia>db2(c) Copyright IBM Corporation 19 ...
- 代码创建xml文档并写入指定节点
//首先创建 XmlDocument xml文档 XmlDocument xml = new XmlDocument(); //创建根节点 config XmlElement config = xml ...
- Udp发送
string message = "0302"; byte[] sendbytes = Encoding.ASCII.GetBytes(message); remoteIpep = ...
- cocos2d CCLOG格式符号表
使用示例: CCLOG(); CCLOG(, 650000L); CCLOG(); CCLOG(); CCLOG(, , , , ); CCLOG("Floats: %4.2f %.0e % ...
- [IDL入门] 两个PPT,IDL上手
首先看看IDL能干什么,<Solving Real Problems with Computer Graphics>ppt是英文的,很精彩. 下载地址:http://pan.baidu.c ...
- linux中服务器定时程序设定
服务器不重启的情况下定时自动重启apache及mysql服务,其实也大同小异.具体步骤如下: 一.每天的12点及16点重启apache及mysql服务 [root@www bin]# cd /opt ...
- 初学HTML5的一点理解
刚接触了一点点用h5移动端的一点知识,用自己最浅薄的理解来看解决自适应屏幕尺寸问题和适应屏幕尺寸的布局问题.这里,为了解决自适应屏幕尺寸问题大概需要做的就是把HTML中的元素的尺寸尽可能的用百分比表示 ...
- C#排列组合类
//----------------------------------------------------------------------------- // // 算法:排列组合类 // // ...
- Eclipse中常用的操作单词
Existing Project into Workspace 现有的工程引入工作空间(加载工程)File 文件New 新建Project 工程Folder 文件夹Import 引入(加载&导 ...
- PAT (Advanced Level) 1074. Reversing Linked List (25)
简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...