2009 Mock Dwite by A.J.: Problem 1

Super Special Awesome Numbers =D

A 'super' number is a number whose digital sum (i.e., the sum of its digits) is even!
A 'special' number is a number with strictly increasing digits!
An 'awesome' number is a number that is not divisible by any perfect square other than 1!

Given a range, determine how many Super Special Awesome numbers lie within it.

Input

The input will contain five lines. Each line will contain two integers L and U (1 ≤ LU ≤ 1 000 000).

Output

For each line given in input, in the order given, output one line containing a single integer: the number of Super Special Awesome numbers between L and U (inclusive).

Sample Input

2 10
30 300
6666 66666
12345 67890
100000 1000000

Sample Output

2
23
51
50
32

All Submissions
Best Solutions


Point Value: 10 (partial)
Time Limit: 60.00s
Memory Limit: 256M
Added: Sep 26, 2009
Author: amleshjk

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)


so hard sad.gif

My results for the grader are nonsensical, based on my code.
I'm getting an output as high as 137998 on the grader, but my program works for the test cases given. Even when I set L to 1 and U to 1000 000, I only got an output of 171. Can someone help?

When this happens it usually means your program is doing something it shouldn't be. The most common causes are accessing arrays out of bounds, which a Windows machine will brush under the carpet, but a Linux one will deal with harshly. Check this page and see if your code is violating any of the mentioned common issues on the grader: http://wcipeg.com/wiki/Judge:Help

Here's a hint: check your compiler warnings. Your code gets AC with the addition of one statement.

My compiler didn't warn me at all, but I found the problem. Thank you for the advice!

Huh. Have you tried compiling with -Wall -Wextra? I'd be surprised if nothing came up...

Lots of my friends just write their code in Dev-C++ instead of compiling it through the command line, I'd hazard to guess that this was the case, and the compiler warning box is rather small and cluttered with other information.

What is wrong in my code?
I am having trouble debugging it. Help would be appreciated.

You seem to have misinterpreted what an awesome number is. An awesome number is a number that cannot be divided by something like 2*2, 3*3, 4*4, etc (you're overcomplicating it). Also remember to reset your super special awesome number count for each test case, and remember to print each answer on a new line.