static double f ( int n , int used ) {
  if ( used == ( 1 << n ) - 1 ) return 0 ;
  if ( DP [ n ] [ used ] != null ) return DP [ n ] [ used ] ;
  double ans = 0 ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    int nxt = i ;
    int money = n ;
    while ( bit_set ( used , nxt ) ) {
      nxt = ( nxt + 1 ) % n ;
      money -- ;
    }
    ans += 1.0 / n * ( money + f ( n , used | 1 << nxt ) ) ;
  }
  return DP [ n ] [ used ] = ans ;
}

static double f ( int n , int used ) { if ( used == ( 1 << n ) - 1 ) return 0 ; if ( DP [ n ] [ used ] != null ) return DP [ n ] [ used ] ; double ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int nxt = i ; int money = n ; while ( bit_set ( used , nxt ) ) { nxt = ( nxt + 1 ) % n ; money -- ; } ans += 1.0 / n * ( money + f ( n , used | 1 << nxt ) ) ; } return DP [ n ] [ used ] = ans ; }
(method_declaration (modifiers) type: (floating_point_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (identifier))) right: (decimal_integer_literal)))) consequence: (return_statement (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (null_literal))) consequence: (return_statement (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_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 (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (while_statement condition: (parenthesized_expression (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier)))) body: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier)))) (expression_statement (update_expression (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (decimal_floating_point_literal) right: (identifier)) right: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (binary_expression left: (decimal_integer_literal) right: (identifier)))))))))))) (return_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (identifier)))))