#P15434. [蓝桥杯 2025 国 Python B] 三角形构造
[蓝桥杯 2025 国 Python B] 三角形构造
Problem Description
Xiao Lan is drawing triangles. He first fixes the length of one side of the triangle as . You need to find how many positive integers satisfy all of the following conditions:
- ;
- The three numbers , , and can form the side lengths of a non-degenerate triangle.
Here, denotes the bitwise OR result of and in binary.
Note: A triangle is non-degenerate, which means its three side lengths must all be positive and satisfy the triangle inequalities: , , and .
If any inequality becomes an equality (for example, ), then the triangle is degenerate (the three points are collinear).
Input Format
Input one line containing a positive integer .
Output Format
Output one line containing an integer representing the answer.
10
7
Hint
Sample Explanation
Valid values of are: .
Constraints
For of the testdata, .
For all testdata, .
Translated by ChatGPT 5