Arjun Suresh (talk | contribs) (Created page with "Pythagorean triplet $(a,b,c)$ satisfies: $a + b = c$ You will be given an integer N. You have to count how many triplets a,b,c exist such that $$1 <= a <= b <= c <= N.$$ ''...") |
Arjun Suresh (talk | contribs) |
||
Line 1: | Line 1: | ||
Pythagorean triplet $(a,b,c)$ satisfies: | Pythagorean triplet $(a,b,c)$ satisfies: | ||
− | $a + b = c$ | + | $$a + b = c$$ |
You will be given an integer N. You have to count how many triplets a,b,c exist such that | You will be given an integer N. You have to count how many triplets a,b,c exist such that | ||
$$1 <= a <= b <= c <= N.$$ | $$1 <= a <= b <= c <= N.$$ | ||
Line 11: | Line 11: | ||
'''Constraints:''' | '''Constraints:''' | ||
− | $$1 <= T <= 100 | + | $$1 <= T <= 100 \\ |
1 <= N <= 10^6$$ | 1 <= N <= 10^6$$ | ||
Pythagorean triplet $(a,b,c)$ satisfies: $$a + b = c$$ You will be given an integer N. You have to count how many triplets a,b,c exist such that $$1 <= a <= b <= c <= N.$$
Input: First line contains T, the number of test cases. Each test case consists of only one integer in one line.
Output: For each test case, print the required answer.
Constraints: $$1 <= T <= 100 \\ 1 <= N <= 10^6$$
Complexity: $O (n)$ <syntaxhighlight lang="c" name="triplet">
</syntaxhighlight>
Pythagorean triplet $(a,b,c)$ satisfies: $$a + b = c$$ You will be given an integer N. You have to count how many triplets a,b,c exist such that $$1 <= a <= b <= c <= N.$$
Input: First line contains T, the number of test cases. Each test case consists of only one integer in one line.
Output: For each test case, print the required answer.
Constraints: $$1 <= T <= 100 \\ 1 <= N <= 10^6$$
Complexity: $O (n)$ <syntaxhighlight lang="c" name="triplet">
</syntaxhighlight>