VM7WC '16 #4 Bronze - Perfect Squares for Not-So-Perfect Cases

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 64M

Authors:
Problem type

After writing so many problems and test cases, Jeffrey is having a horrible headache! However, he must finish writing the problems for the Seven Week Challenge. At this point, in this much pain, Jeffrey really doesn't care about how much the headache will affect the quality of his problems. He is happy and will feel better about himself as long as he gets them done.

Jeffrey is currently writing up a problem on numbers. He would like the users to classify all numbers from A to B (inclusive) based on the properties associated with the numbers. As a child prodigy, Jeffrey knows how to classify even and odd numbers, as well as prime and composite numbers. But after quitting Sunday Math, Jeffrey has forgotten how to identify if a number is a perfect square or not!

Of course, the users cannot know about this! Jeffrey must hide this fact and has come to you for help in identifying the perfect squares. Jeffrey will give you two integers, A and B, and would like to know how many perfect squares there are within the range (inclusive)! We consider 0 to be a perfect square.

Input Specification

The input consists of a line with two space-separated integers, A and B (-10\,000 \le A,B \le 10\,000).

Output Specification

An integer representing the number of perfect squares between A and B inclusive.

Sample Input

10 50

Sample Output

4

Comments

There are no comments at the moment.