private static void solve ( ) {
  int n = sc . nextInt ( ) ;
  int k = sc . nextInt ( ) ;
  double [ ] [ ] dp = new double [ k + 1 ] [ n + 1 ] ;
  double [ ] [ ] dp2 = new double [ k + 1 ] [ n + 1 ] ;
  for ( int i = 0 ;
  i <= k ;
  i ++ ) {
    dp2 [ i ] [ 0 ] = 1 ;
  }
  for ( int i = 1 ;
  i <= n ;
  i ++ ) {
    double p = ( double ) 1 / ( n - i + 1 ) ;
    for ( int j = 0 ;
    j <= k ;
    j ++ ) {
      dp [ j ] [ i ] = dp [ j ] [ i - 1 ] * ( 1 - p ) ;
      dp2 [ j ] [ i ] = dp2 [ j ] [ i - 1 ] * ( 1 - p ) ;
      double tmp = 0 ;
      if ( j > 0 ) {
        tmp = dp2 [ j - 1 ] [ i - 1 ] * p ;
      }
      else {
      }
      dp [ j ] [ i ] += Math . max ( tmp , dp [ j ] [ i - 1 ] * p ) ;
      dp2 [ j ] [ i ] += Math . max ( tmp , dp [ j ] [ i - 1 ] * p ) ;
    }
  }
  pr . printf ( "%.7f\n" , dp [ k ] [ n ] ) ;
}

private static void solve ( ) { int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; double [ ] [ ] dp = new double [ k + 1 ] [ n + 1 ] ; double [ ] [ ] dp2 = new double [ k + 1 ] [ n + 1 ] ; for ( int i = 0 ; i <= k ; i ++ ) { dp2 [ i ] [ 0 ] = 1 ; } for ( int i = 1 ; i <= n ; i ++ ) { double p = ( double ) 1 / ( n - i + 1 ) ; for ( int j = 0 ; j <= k ; j ++ ) { dp [ j ] [ i ] = dp [ j ] [ i - 1 ] * ( 1 - p ) ; dp2 [ j ] [ i ] = dp2 [ j ] [ i - 1 ] * ( 1 - p ) ; double tmp = 0 ; if ( j > 0 ) { tmp = dp2 [ j - 1 ] [ i - 1 ] * p ; } else { } dp [ j ] [ i ] += Math . max ( tmp , dp [ j ] [ i - 1 ] * p ) ; dp2 [ j ] [ i ] += Math . max ( tmp , dp [ j ] [ i - 1 ] * p ) ; } } pr . printf ( " % .7f \n " , dp [ k ] [ n ] ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (floating_point_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (floating_point_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal))) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (local_variable_declaration type: (array_type element: (floating_point_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (floating_point_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal))) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (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 (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (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: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (cast_expression type: (floating_point_type) value: (decimal_integer_literal)) right: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (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 (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (identifier)))))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (identifier)))))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (array_access array: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier))))) alternative: (block)) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier)))))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier)))))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal) (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))))))