A. pythagorean theorem II

Source: Internet
Author: User
Tags cmath
Time limit per test

3 seconds

Memory limit per test

256 megabytes

Input

Standard Input

Output

Standard output

In mathematics, the Pythagorean theorem-is a relation in Euclidean Geometry among the three sides of a right-angled triangle. In terms of areas, it states:

In any right-angled triangle, the area of the square whose side is the hypotenuse (the side opposite the right angle) is equal to the sum of the areas of the squares whose sides are the two legs (
Two sides that meet at a right angle ).

The theorem can be written as an equation relating the lengths of the sidesA,BAndC,
Often called the Pythagorean equation:

A2Region + Region B2Signature = Signature C2

WhereCRepresents the length of the hypotenuse, andAAndBRepresent
The lengths of the other two sides.

GivenN, Your task is to count how many right-angled triangles with side-lengthsA,BAndCThat
Satisfied an inequality1 bytes ≤ bytesALimit ≤ limitBLimit ≤ limitCLimit ≤ limitN.

Input

The only line contains one integerN(1 digit ≤ DigitNLimit ≤ limit 104)As
We mentioned above.

Output

Print a single integer-the answer to the problem.

Sample test (s) Input
5
Output
 
1
Input
74
Output
 
35

Problem solving Description: This is to judge how many numbers in the N range can constitute a right triangle, just use brute force.

 # include 
  
    # include 
   
     # include 
    
      # include 
     
       # include 
      
        using namespace STD; int main () {int N, I, J, K, H = 0; float D; scanf ("% d", & N); for (I = 1; I 
       
      
     
    
   
  

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.