Change parity
Practice
4.5 (2 votes)
Binary search algorithm
Mathamatics
Basic math
Easy
Mathematics
Mathematics
Problem
83% Success 445 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Let \( P(X)\) be the parity of a number which is defined as N, where N is the number of integers that divide X.
You are given a number X and you have to determine the smallest number Y such that Y > X and \( P(Y) != P(X)\).
Input format
- First line: T (number of test cases)
- For each test case: X
Output format
For each test case, print the required answer on a separate line.
Constraints
\(1 \le T \le 10^{5} \)
\(1 \le X \le 10^8 \)
Submissions
Please login to view your submissions
Similar Problems
Points:20
98 votes
Tags:
AlgorithmsBinary SearchEasyMathSearching
Points:20
29 votes
Tags:
ApprovedBasic ProgrammingEasyOpen
Points:20
6 votes
Tags:
ImplementationBasic ProgrammingAd-HocEasyMathematicsOpenApprovedMathamatics
Editorial