In this repository, I work on my capabilities to solve algorithmic questions. I determine the problems as issues, and then tackle and solve them. I use various sources to choose questions.
We want to count the number of unordered triples (a, b, c) such that a triangle with sides a, b, and c can be formed, and their sum is equal to n.
Note that in an unordered triple, the order of numbers does not matter. For example, the triple (2, 3, 2) is the same as (2, 2, 3), and it should be counted only once.
Input: The only input line contains a natural number, n.
3 ≤ n ≤ 1000000
Output: Provide the solution to the problem in a single output line.
Time limit: 1 second Memory limit: 256 megabytes
We want to count the number of unordered triples (a, b, c) such that a triangle with sides a, b, and c can be formed, and their sum is equal to n.
Note that in an unordered triple, the order of numbers does not matter. For example, the triple (2, 3, 2) is the same as (2, 2, 3), and it should be counted only once.
Input: The only input line contains a natural number, n. 3 ≤ n ≤ 1000000
Output: Provide the solution to the problem in a single output line.
Sample Input 1: 5 Sample Output 1: 1
Sample Input 2: 12 Sample Output 2: 3