static int countWaysUtil ( int x , int n , int num ) {
  int val = ( int ) ( x - Math . pow ( num , n ) ) ;
  if ( val == 0 ) return 1 ;
  if ( val < 0 ) return 0 ;
  return countWaysUtil ( val , n , num + 1 ) + countWaysUtil ( x , n , num + 1 ) ;
}

static int countWaysUtil ( int x , int n , int num ) { int val = ( int ) ( x - Math . pow ( num , n ) ) ; if ( val == 0 ) return 1 ; if ( val < 0 ) return 0 ; return countWaysUtil ( val , n , num + 1 ) + countWaysUtil ( x , n , num + 1 ) ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (cast_expression type: (integral_type) value: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier)))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (return_statement (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (return_statement (decimal_integer_literal))) (return_statement (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal))))))))