Problem hidden
|This problem was hidden by Editorial Board member probably because it has incorrect language|version or invalid test data, or description of the problem is not clear.|

RGB7213 - Үржвэр нийлбэр 1

1*2+2*3+3*4+...+n*(n+1) нийлбэрийг ол.

Input

Натурал тоо өгөгдөнө.

Output

Нийлбэр

Example

Input:
5

Output:
70

Нэмсэн:Bataa
Огноо:2013-01-21
Хугацааны хязгаарлалт:1s
Эх кодын хэмжээний хязгаарлалт:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Програмчлалын хэлүүд:ADA95 ASM32 BASH BF C NCSHARP CSHARP C++ 4.3.2 CPP C99 CLPS LISP sbcl LISP clisp D ERL FORTRAN HASK ICON ICK JAVA JS-RHINO JULIA LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON PYPY3 PYTHON3 RUBY SCALA SCM guile ST TCL WHITESPACE

hide comments
2019-12-26 08:24:06
#include <iostream>
using namespace std;
int main()
{
int a;
cin >> a;
int n = 0;
int b = 1;
int e;
int c = 0;
while (n < a)
{
n = (n + 1);
b = (n + 1);
e = (n * b);
c = (c + e);
}
cout << c << endl;
}
2019-10-26 15:44:05
#include <cstdio>
int main()
{
int a;
scanf ("%d",&a);
int b=a*(a+1)*(a+2)/3;
printf("%d",b);
return 0;
}
2019-03-06 04:05:43
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main() {
int a,b=0,c=0,d,i;
scanf("%d",&a);
for(i=1;i<=a;i++){
b=b+i*(i+1); }
printf("%d",b);
return 0;
}
2018-12-21 05:45:49
#include <bits/stdc++.h>
using namespace std;

int main ()
{
int n, i, sum = 0 ,d;
cin >> n;
int a[n];
for (i = 1; i <= n; i++)
{
d=i*(i+1);
sum+=d;

}
cout<<sum;
return 0;
}
2018-11-22 11:56:26


Last edit: 2018-11-22 11:56:37
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.