orrect answer will be upvoted else downvoted. Computer science.    Vasya concentrates on the properties of right triangles, and he utilizes a recipe that decides whether some triple of integers is Pythagorean. Lamentably, he has failed to remember the specific recipe; he recalls just that the recipe was some condition with squares. Along these lines, he concocted the accompanying equation: c=a2−b.    Clearly, this isn't the right recipe to check if a triple of numbers is Pythagorean. Yet, amazingly, it really dealt with the triple (3,4,5): 5=32−4, thus, as indicated by Vasya's equation, it is a Pythagorean triple.    When Vasya tracked down the right recipe (and comprehended that his equation is off-base), he pondered: what number of are there triples of integers (a,b,c) with 1≤a≤b≤c≤n to such an extent that they are Pythagorean both as per his equation and the genuine definition? He requested that you count these triples.    Input    The principal line contains one integer t (1≤t≤104) — the number of experiments.    Each experiment comprises of one line containing one integer n (1≤n≤109).    Output    For each experiment, print one integer — the number of triples of integers (a,b,c) with 1≤a≤b≤c≤n to such an extent that they are Pythagorean agreeing both to the genuine definition and to the recipe Va

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Correct answer will be upvoted else downvoted. Computer science.

 

 Vasya concentrates on the properties of right triangles, and he utilizes a recipe that decides whether some triple of integers is Pythagorean. Lamentably, he has failed to remember the specific recipe; he recalls just that the recipe was some condition with squares. Along these lines, he concocted the accompanying equation: c=a2−b. 

 

Clearly, this isn't the right recipe to check if a triple of numbers is Pythagorean. Yet, amazingly, it really dealt with the triple (3,4,5): 5=32−4, thus, as indicated by Vasya's equation, it is a Pythagorean triple. 

 

When Vasya tracked down the right recipe (and comprehended that his equation is off-base), he pondered: what number of are there triples of integers (a,b,c) with 1≤a≤b≤c≤n to such an extent that they are Pythagorean both as per his equation and the genuine definition? He requested that you count these triples. 

 

Input 

 

The principal line contains one integer t (1≤t≤104) — the number of experiments. 

 

Each experiment comprises of one line containing one integer n (1≤n≤109). 

 

Output 

 

For each experiment, print one integer — the number of triples of integers (a,b,c) with 1≤a≤b≤c≤n to such an extent that they are Pythagorean agreeing both to the genuine definition and to the recipe Vasya thought of.

 

 

Expert Solution
steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY