title: Sum Matrix Element Element Integer Division Row Column 1
signature: func sumMatrixElementElementIntegerDivisionRowColumn1(n int) int {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int, expected int) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(n int, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(n),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(35, 630)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(93, 4371)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(7, 28)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(81, 3321)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(80, 3240)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(47, 1128)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(7, 28)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(41, 861)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(59, 1770)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(34, 595)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def sum_matrix_element_element_integer_division_row_column_1(n):
      ans = 0
      temp = 0
      for i in range(1, (n + 1)):
          if (temp < n):
              temp = (i - 1)
              num = 1
              while (temp < n):
                  if ((temp + i) <= n):
                      ans += (i * num)
                  else:
                      ans += ((n - temp) * num)
                  temp += i
                  num += 1
      return ans
source_cpp: int sum_matrix_element_element_integer_division_row_column_1(int n) {
    int ans = 0, temp = 0, num;
    for ( int i = 1;
    i <= n && temp < n;
    i ++ ) {
      temp = i - 1;
      num = 1;
      while ( temp < n ) {
        if ( temp + i <= n ) ans += ( i * num );
        else ans += ( ( n - temp ) * num );
        temp += i;
        num ++;
      }
    }
    return ans;
  }