private static double solve ( int n , double [ ] p , double [ ] c ) {
  double maxt = 0.0 ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    for ( int j = 0 ;
    j < n ;
    j ++ ) {
      if ( p [ i ] > p [ j ] ) {
        double x = ( c [ i ] * p [ i ] + c [ j ] * p [ j ] ) / ( c [ i ] + c [ j ] ) ;
        double t = c [ i ] * ( p [ i ] - x ) ;
        maxt = Math . max ( maxt , t ) ;
      }
    }
  }
  return maxt ;
}

private static double solve ( int n , double [ ] p , double [ ] c ) { double maxt = 0.0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( p [ i ] > p [ j ] ) { double x = ( c [ i ] * p [ i ] + c [ j ] * p [ j ] ) / ( c [ i ] + c [ j ] ) ; double t = c [ i ] * ( p [ i ] - x ) ; maxt = Math . max ( maxt , t ) ; } } } return maxt ; }
(method_declaration (modifiers) type: (floating_point_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (array_type element: (floating_point_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (array_type element: (floating_point_type) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (decimal_floating_point_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) consequence: (block (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier))))) right: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier))))))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))))))))) (return_statement (identifier))))