题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5327
题意:一个数所有位的数字没有重复即是"漂亮的数",问[L,R]里有几个这样的数
思路:数据不大,暴力打表,比较无脑
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int num[100030];
int main()
{
for (int i=1;i<=100000;i++)
{
int vis[10]={0};
int flag=1,now=i;
while (now)
{
int tmp=now%10;
now/=10;
if (vis[tmp]) flag=0;
else vis[tmp]=1;
}
if (flag) num[i]=num[i-1]+1;
else num[i]=num[i-1];
}
int t,l,r;
scanf("%d",&t);
while (t--)
{
scanf("%d%d",&l,&r);
printf("%d\n",num[r]-num[l-1]);
}
}