We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

# Minimum Height Triangle

# Minimum Height Triangle

+ 0 comments C++: No need for floats

int main() { uint32_t a, b; cin >> b >> a; cout << 2 * a / b + bool((2 * a) % b); return 0; }

+ 0 comments In the C# stub, base is a keyword and can't be used as a variable.

+ 0 comments C++: One line solution without using float

int lowestTriangle(int base, int area){ // Complete this function return (area * 2 + (base - 1)) / base; }

+ 0 comments height = (int)Math.ceil((2.0*area)/base);

+ 0 comments I am so mad. One of the test cases' answer was 2000000 and C++ std::cout gave the output as 2e+06 instead of 2000000 so it gave a wrong answer... I really need to start using std::printf everywhere.

Load more conversations

Sort 279 Discussions, By:

Please Login in order to post a comment