LittleElephantAndDouble
SRM 597 · 2013-06-25 · by Witaliy
Problem Statement
Little Elephant from the Zoo of Lviv likes integers.
You are given an
Notes
- The return value is case-sensitive. Make sure that you return the exact strings "YES" and "NO".
Constraints
- A will contain between 1 and 50 elements, inclusive.
- Each element of A will be between 1 and 1,000,000,000, inclusive.
{1, 2}
Returns: "YES"
One possible way of making all elements equal is to double the element at index 0.
{1, 2, 3}
Returns: "NO"
It's impossible to make all three elements equal in this case.
{4, 8, 2, 1, 16}
Returns: "YES"
{94, 752, 94, 376, 1504}
Returns: "YES"
{148, 298, 1184}
Returns: "NO"
Submissions are judged against all 121 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class LittleElephantAndDouble with a public method string getAnswer(vector<int> A) · 121 test cases · 2 s / 256 MB per case