title: Double Factorial 1
signature: class Solution {
  
      public long DoubleFactorial1(int n) {
test_code: using System;
  using System.Numerics;
  using System.Diagnostics;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Security.Cryptography;
  using System.Web.UI;
  using System.Web.Script.Serialization;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  namespace EvaluatePrediction {
      class TestRunner {
          public bool ValidateSolution(long actual, long expected){
              return new JavaScriptSerializer().Serialize(actual) == new JavaScriptSerializer().Serialize(expected);
          }
  
          public string driver(int n, long expected){
              try{
                PLACEHOLDER_CLS_NAME solution_cls = new PLACEHOLDER_CLS_NAME();
                long pred_result = solution_cls.PLACEHOLDER_FN_NAME(n); 
                if (ValidateSolution(
                      pred_result,
                      expected)){
                  return "PASSED";
                }
                return "FAILED";
              } 
              catch (Exception exception_obj)
              {
                return exception_obj.GetType().FullName;
              }
          }
          static void Main(string[] args) {
              TestRunner runner = new TestRunner();
              String result;
              result = runner.driver(
                  24, 
                  1961990553600
              );
              Console.WriteLine(string.Format(
                  "TEST-0...{0}",
                  result)
              );result = runner.driver(
                  3, 
                  3
              );
              Console.WriteLine(string.Format(
                  "TEST-1...{0}",
                  result)
              );result = runner.driver(
                  22, 
                  81749606400
              );
              Console.WriteLine(string.Format(
                  "TEST-2...{0}",
                  result)
              );result = runner.driver(
                  2, 
                  2
              );
              Console.WriteLine(string.Format(
                  "TEST-3...{0}",
                  result)
              );result = runner.driver(
                  30, 
                  42849873690624000
              );
              Console.WriteLine(string.Format(
                  "TEST-4...{0}",
                  result)
              );result = runner.driver(
                  2, 
                  2
              );
              Console.WriteLine(string.Format(
                  "TEST-5...{0}",
                  result)
              );
          }
      }
  }
  
source_py: def double_factorial_1(n):
      res = 1
      for i in range(n, (- 1), (- 2)):
          if ((i == 0) or (i == 1)):
              return res
          else:
              res *= i
source_cpp: unsigned int double_factorial_1(unsigned int n) {
    int res = 1;
    for ( int i = n;
    i >= 0;
    i = i - 2 ) {
      if ( i == 0 || i == 1 ) return res;
      else res *= i;
    }
  }