/*** | |
Md. Namzul Hasan | |
Shahjalal University of Science & Technology,Sylhet. | |
hasan08sust@gmail.com | |
***/ | |
#include<iostream> | |
#include<cstdio> | |
#include<stack> | |
#include<queue> | |
#include<map> | |
#include<vector> | |
#include<algorithm> | |
#include<cstring> | |
#include<sstream> | |
#include<cmath> | |
#include <iomanip> | |
using namespace std ; | |
typedef long long ll ; | |
typedef int in ; | |
typedef unsigned long long ull ; | |
const double pi = 2*acos(0) ; | |
#define maxi 40000 | |
#define pf printf | |
#define sc scanf | |
#define pb push_back | |
#define MEM(x,y) (memset((x),(y),sizeof(x))) | |
#define MIN(x,y) ((x) < (y) ? (x) : (y)) | |
#define MAX(x,y) ((x) > (y) ? (x) : (y)) | |
#define load(array,size) for(int i=0 ; i<size ; i++) cin>>array[i] ; | |
#define new_line pf("\n") | |
#define clear_data(array) memset(array,0,sizeof(array)) | |
#define highest_int 2147483647 | |
int data[5002]; | |
bool isRepeated(int p){ | |
bool check[20]; | |
memset(check,false,sizeof(check)); | |
int mod; | |
while(p){ | |
mod = p%10; | |
if(check[mod]) | |
return false; | |
check[mod] = true; | |
p = p/10; | |
} | |
return true; | |
} | |
void fixData(){ | |
memset(data,0,sizeof(data)); | |
for(int i=1 ; i<=5000 ; i++){ | |
if(isRepeated(i)){ | |
data[i] = data[i-1] +1; | |
}else{ | |
data[i] = data[i-1]; | |
} | |
} | |
} | |
int main() | |
{ | |
int n,m,q; | |
fixData(); | |
while(sc("%d %d",&n,&m)==2){ | |
q = data[m] - data[n-1]; | |
pf("%d\n",q); | |
} | |
return 0; | |
} |
25 October 2017
UVA 12527 Different Digits
Subscribe to:
Post Comments (Atom)
-
/*** Md. Nazmul Hasan Shahjalal University of Science & Technology,Sylhet. hasan08sust@gmail.com ***/ #include<iostream> #i...
-
n = 1 while n: str = input () # print('Case no# %d :'%n) if str == ' * ' : break if str == ' Hajj ...
-
/*** Md. Namzul Hasan Shahjalal University of Science & technology,sylhet. hasan08sust@gmail.com ***/ #include<bits/stdc++.h...
No comments:
Post a Comment