Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- INPUT:
- 87 104
- 989 1022
- 22 25
- 1234 1234
- OUTPUT:
- 14
- 0
- 3
- 1
- */
- #include <stdio.h>
- #define f(i, s, t) for (int i = s; i < t; ++i)
- int main() {
- int n, m, a, b, c, d, ans;
- while(scanf("%d%d", &n, &m) != EOF) {
- ans = 0;
- f(i,n,m+1) {
- a = i / 1000, b = i % 1000 / 100,
- c = i % 100 / 10, d = i % 10;
- if(!a) a = -1;
- if(!b && a == -1) b = -1;
- if(!c && b == -1) c = -1;
- if((a == -1 || (a != b && a != c && a != d)) && (b == -1 || (b != c && b != d)) && (c == -1 || (c != d))) {
- ++ans;
- }
- }
- printf("%d\n", ans);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement