title: Number Ways Node Make Loop Size K Undirected Complete Connected Graph N Nodes
signature: fun numberWaysNodeMakeLoopSizeKUndirectedCompleteConnectedGraphNNodes(n: Int, k: Int): Float {
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;
  }
question_info.test_list: [{"idx": 0, "outputs": 15.0, "inputs": {"n": 16, "k": 2}}]
question_info.extension: kts
question_info.test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Float, expected:Float):Boolean{
    return abs(actual - expected) < 1e-06f
  }
  fun driver(n: Int, k: Int, expected:Float):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(n, k), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(16, 2, 15.0f)
      println("TEST-0...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: numberWaysNodeMakeLoopSizeKUndirectedCompleteConnectedGraphNNodes
question_info.entry_cls_name: Solution
question_info.test_case_ids: 0
question_info.commands: kotlinc -script __FILENAME__ -no-reflect -nowarn