UVA 11461 Square numbers Problem solving report

Source: Internet
Author: User

Discription

A square number is an integer number whose square root was also an integer. For example 1, 4, Bayi is some square numbers. Given numbers A and b you'll have to find out how many square numbers is there between A and B (inclusive).

Input

The input file contains at most 201 lines of inputs. Each line contains integers a and b (0 < a≤b≤100000). Input is terminated by a line containing the zeroes. This is should not being processed.

Output

For each line of input produce one line of output. This line contains an integer which denotes how many square numbers is there between A and B (inclusive).

Sample Input

1 4

1 10

0 0

Sample Output

2

3

Analysis

It's a very simple math problem. (first time to participate in the school race to do the first question, the placid ac .....) )

AC Code

#include <iostream> #include <cstdio> #include <cmath>using namespace std;int main (int argc, char const *argv[]) {int A, b;while ((scanf ("%d%d", &a, &b) = = 2) {if (a = = 0 && b = = 0) break;printf ("%d\n", (int) (Flo or (sqrt (b))-Ceil (sqrt (a)) + 1);}}

  

UVA 11461 Square numbers Problem solving report

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.