TopXorerEasy
SRM 723 · 2017-11-17 · by cgy4ever
SRM 723 · 2017-11-17 · by cgy4ever · Math
Problem Statement
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 theint s 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
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
0)
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)
1 2 4 Returns: 7
Here the only optimal solution is to select people with the largest possible ratings: (1, 2, 4).
2)
3 4 5 Returns: 7
3)
1 100 10000 Returns: 10101
4)
1000000000 1000000000 1000000000 Returns: 1073741823
Submissions are judged against all 100 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Coding Area
Language: C++17 · define a public class TopXorerEasy with a public method int maximalRating(int A, int B, int C) · 100 test cases · 2 s / 256 MB per case