Problem Statement
Like Topcoder, TopXorer uses a rating system.
The rating of each person is a non-negative integer.
You are a coach. You want to select a three-person team. You have the following goals:
You are given the ints A, B, and C. Please compute and return the maximal team rating your team can have.
You are a coach. You want to select a three-person team. You have the following goals:
- The rating of the first team member must be between 0 and A, inclusive.
- The rating of the second team member must be between 0 and B, inclusive.
- The rating of the third team member must be between 0 and C, inclusive.
You are given the ints A, B, and C. Please compute and return the maximal team rating your team can have.
Definition
- Class:
- TopXorerEasy
- Method:
- maximalRating
- Parameters:
- int, int, int
- Returns:
- int
- Method signature:
- int maximalRating(int A, int B, int C)
- (be sure your method is public)
Constraints
- A will be between 0 and 1,000,000,000, inclusive.
- B will be between 0 and 1,000,000,000, inclusive.
- C will be between 0 and 1,000,000,000, inclusive.
Examples
2
1
0
Returns: 3
One of the optimal solutions is to select people with ratings (2, 1, 0). The team rating will then be (2 xor 1 xor 0) = 3.1
2
4
Returns: 7
Here the only optimal solution is to select people with the largest possible ratings: (1, 2, 4).3
4
5
Returns: 7
1
100
10000
Returns: 10101
1000000000
1000000000
1000000000
Returns: 1073741823
0
0
0
Returns: 0