HDU 5327 Olympiad (多校)
Olympiad
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 631 Accepted Submission(s): 436
are one of the competitors of the Olympiad in numbers. The problem of
this year relates to beatiful numbers. One integer is called beautiful
if and only if all of its digitals are different (i.e. 12345 is
beautiful, 11 is not beautiful and 100 is not beautiful). Every time you
are asked to count how many beautiful numbers there are in the interval
[a,b] (a≤b). Please be fast to get the gold medal!
For each test case, there are two numbers a and b, as described in the statement. It is guaranteed that 1≤a≤b≤100000.
1 10
1 1000
738
#include<queue>
#include<math.h>
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
#define N 123456
#define M 12 int a,b;
int ha[M],f[N];
int judge(int x)
{
int n;
memset(ha,,sizeof(ha));
while(x)
{
n=x%;
if(ha[n])return ;
else ha[n]=;
x=x/;
}
return ;
} int main()
{
f[]=;
for(int i=;i<;i++)
{
f[i]=f[i-];
if( judge(i) )
f[i]++;
}
int t;cin>>t;
while(t--)
{
scanf("%d%d",&a,&b);
cout<<f[b]-f[a-]<<endl;
}
return ;
}
HDU 5327 Olympiad (多校)的更多相关文章
- hdu 5327 Olympiad
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5327 Olympiad Description You are one of the competit ...
- HDU - 5327 Olympiad(一维前缀和)
Olympiad Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Problem ...
- HDU 5327 Olympiad (水题)
题意:beautiful数字定义为该数字中的十进制形式每一位都不同,给一个区间[L,R],求该区间中有多少个beautiful数字. 思路:数字不大,直接暴力预处理,再统计区间[1,i]有多少个,用c ...
- hdu 5288||2015多校联合第一场1001题
pid=5288">http://acm.hdu.edu.cn/showproblem.php?pid=5288 Problem Description OO has got a ar ...
- HDU 6140 17多校8 Hybrid Crystals(思维题)
题目传送: Hybrid Crystals Problem Description > Kyber crystals, also called the living crystal or sim ...
- HDU 5792---2016暑假多校联合---World is Exploding
2016暑假多校联合---World is Exploding Problem Description Given a sequence A with length n,count how many ...
- HDU 6143 17多校8 Killer Names(组合数学)
题目传送:Killer Names Problem Description > Galen Marek, codenamed Starkiller, was a male Human appre ...
- HDU 6045 17多校2 Is Derek lying?
题目传送:http://acm.hdu.edu.cn/showproblem.php?pid=6045 Time Limit: 3000/1000 MS (Java/Others) Memory ...
- Time Zone 【模拟时区转换】(HDU暑假2018多校第一场)
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6308 Time Zone Time Limit: 2000/1000 MS (Java/Others) ...
随机推荐
- 洛谷P3961 图的遍历
题目来源 做这道题的方法不少. 在这里我只提一种 就是大法师. 可以采用反向建边,从最大的点开始dfs 我们考虑每次从所剩点中最大的一个点出发,我们暂且称它为i,而凡是i这个点所能到达的点,可以到达的 ...
- jmx_exportter+prometheus+grafana监控hadoop
0.介绍(摘录自https://www.hi-linux.com/posts/25047.html) 什么是Prometheus? Prometheus是由SoundCloud开发的开源监控报警系统和 ...
- div+css居中
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 如何用Jquery做图片展示效果
一. 前言 到底用JQuery做出怎样的展示效果? 让我们先来看一下!网页加载时,如图所示: 二.本人思路 这个效果初学者看起来好像有点复杂,其实不太难,关键是理清思路,从后端的数据库中找出我们要展示 ...
- Python第三方库之openpyxl(11)
Python第三方库之openpyxl(11) Stock Charts(股票图) 在工作表上按特定顺序排列的列或行中的数据可以在股票图表中绘制.正如其名称所暗示的,股票图表通常被用来说明股价的波动. ...
- Charlie's Change(完全背包记录路径)
Charlie is a driver of Advanced Cargo Movement, Ltd. Charlie drives a lot and so he often buys coffe ...
- struts2知识系统整理
1.MVC 和 JSP Model 2 ** a.:M-Model 模型 包含两部分:业务数据和业务处理逻辑 b.V-View 视图:视图(View)的职责是负责显示界面和用户交互(收集用户信息 ...
- Axure:从单一评价方式到用户自由选择
导读: 亲,还记得淘宝对货物的评价方式吗?还记得对快递哥的评价方式吗? 1,经典五星评: ...
- ASP.NET项目使用MYSQL数据库部署到IIS服务器找不到请求的.Net Framework Data Provider解决方案
使用MySQL开发过程中在自己的机器上跑项目是没有问题的,但在实际部署到服务器上的时候就发生“找不到请求的.Net Framework Data Provider解决方案”错误,在排除项目本身原因之后 ...
- [luoguP2495] [SDOI2011]消耗战(DP + 虚树)
传送门 明显虚树. 别的题解里都是这样说的. 先不考虑虚树,假设只有一组询问,该如何dp? f[u]表示把子树u中所有的有资源的节点都切掉的最优解 如果节点u需要切掉了话,$f[u]=val[u]$ ...