title: Number Ways Node Make Loop Size K Undirected Complete Connected Graph N Nodes
signature: function numberWaysNodeMakeLoopSizeKUndirectedCompleteConnectedGraphNNodes($n, $k) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return abs($actual - $expected) < 1e-06;
  }
  
  function driver($n, $k, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($n, $k), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        16, 2, 
        15.0));
      
  }
  
  main();
  ?>
source_py: def number_ways_node_make_loop_size_k_undirected_complete_connected_graph_n_nodes(n, k):
      p = 1
      if (k % 2):
          p = (- 1)
      return ((pow((n - 1), k) + (p * (n - 1))) / n)
source_cpp: int number_ways_node_make_loop_size_k_undirected_complete_connected_graph_n_nodes(int n, int k) {
    int p = 1;
    if ( k % 2 ) p = - 1;
    return ( pow ( n - 1, k ) + p * ( n - 1 ) ) / n;
  }