Title Address: HDU 5327
Test instructions: Beautiful numbers definition: is a number of each bit can not have the same number, now give you a range, let you ask how many such beautiful number in this interval.
#include <stdio.h>#include <math.h>#include <string.h>#include <stdlib.h>#include <iostream>#include <sstream>#include <algorithm>#include <set>#include <queue>#include <stack>#include <map>#pragma COMMENT (linker, "/stack:102400000,102400000")using namespace STD;typedef Long LongLL;Const intinf=0x3f3f3f3f;Const DoublePi=ACOs(-1.0);Const Doubleesp=1e-8;Const intmaxn=1e5+Ten;intF[MAXN];inta[Ten];intCheckintx) {memsetA0,sizeof(a)); for(; x;x/=Ten){if(a[x%Ten])return 0;Elsea[x%Ten]=1; }return 1;}intMain () {memset(F,0,sizeof(f)); for(intI=1; i<=maxn;i++) f[i]=f[i-1]+check (i);intT,n,m;scanf("%d", &t); while(t--) {scanf("%d%d", &n,&m);printf("%d\n", f[m]-f[n-1]); }return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
HDU 5327 (more than 2015 schools 4)-OLYMPIAD (water problem)