title: Sum Matrix Element Element Integer Division Row Column 1
signature: function sumMatrixElementElementIntegerDivisionRowColumn1($n) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return serialize($actual) == serialize($expected);
  }
  
  function driver($n, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($n), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        35, 
        630));
      
      printf("TEST-1...%s\n",driver(
        93, 
        4371));
      
      printf("TEST-2...%s\n",driver(
        7, 
        28));
      
      printf("TEST-3...%s\n",driver(
        81, 
        3321));
      
      printf("TEST-4...%s\n",driver(
        80, 
        3240));
      
      printf("TEST-5...%s\n",driver(
        47, 
        1128));
      
      printf("TEST-6...%s\n",driver(
        7, 
        28));
      
      printf("TEST-7...%s\n",driver(
        41, 
        861));
      
      printf("TEST-8...%s\n",driver(
        59, 
        1770));
      
      printf("TEST-9...%s\n",driver(
        34, 
        595));
      
  }
  
  main();
  ?>
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;
  }