SRM524 Div2 Easy(250) ShippingCubes
#include <algorithm> using namespace std; class ShippingCubes{public: int minimalCost( int N ) { int ans = N+2; for ( int x=1; x<=N; x++ ) for ( int y=1; y<=N; y++ ) for ( int z=1; z<=N; z++ ) if ( x*y*z==N ) ans = min( ans, x+y+z ); return ans; }};