title: Sum Matrix Element Element Integer Division Row Column 1
signature: sum_matrix_element_element_integer_division_row_column_1 <- function(n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          35L, 
          630L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          93L, 
          4371L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          7L, 
          28L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          81L, 
          3321L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          80L, 
          3240L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          47L, 
          1128L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          7L, 
          28L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          41L, 
          861L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          59L, 
          1770L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          34L, 
          595L
      )))
  
  }
  
  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;
  }