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
2025-05-20 08:52:48
#include <iostream>
using namespace std;
long long m,k,n,i,a[100],b[100],c[100],d[100];
int main()
{
cin>>n;
for (i=1; i<=n; i++){

cin>>b[i];
a[1]=b[1];
a[2]=b[2];
c[1]=0;
c[2]=0;
for (i=3; i<=n; i++)
if (a[i-1]<a[i-2]) { a[i]=a[i-1]+b[i]; c[i]=i-1; }
else { a[i]=a[i-2]+b[i]; c[i]=i-2; }
cout<<a[n]<<endl;
int j=0;
while (n!=0)
{

j++;
d[j]=n;
n=c[n];
}
for (i=j; i>=1; i--)
cout<<d[i]<<" ";
return 0;
}

Last edit: 2025-05-20 08:55:52
2025-05-20 08:51:16
2

Last edit: 2025-05-20 08:51:25
2025-05-20 08:51:16
e

Last edit: 2025-05-20 08:52:12
2025-05-20 08:51:15
g

Last edit: 2025-05-20 08:52:19
2025-05-06 08:54:45
12345678910
12345678910
10987654321
10987654321
67890

Last edit: 2025-05-20 06:49:30
2025-05-06 08:53:22
ermuun sn nz


Last edit: 2025-05-06 08:54:29
2025-04-22 09:07:58
#include <iostream>
using namespace std;
int main()
{
long long n,i,b,s;
cin>>n;
long long a[n];
s = 1;
for(i=1;i<=n;i++)
{
s = s*i;
}
a[n] = s;
for(i=n-1;i>=1;i--)
{
a[i]=a[i+1]/(i+1);
}
for(i=1;i<=n;i++)
cout<<i<<"!="<<a[i]<<"\n";
}

2025-02-19 03:18:40
#include <iostream>
#include <sstream>
#include <string>
#include <cstdlib>
#include <cmath>

using namespace std;

// Headers
string toString (double);
int toInt (string);
double toDouble (string);

int main() {
int n, h, i;

cin >> n;
h = 0;
for (i = 1; i <= n; i++) {
h = h + i * (i + 1);
}
cout << h << endl;
return 0;
}

// The following implements type conversion functions.
string toString (double value) { //int also
stringstream temp;
temp << value;
return temp.str();
}

int toInt (string text) {
return atoi(text.c_str());
}

double toDouble (string text) {
return atof(text.c_str());
}
2025-01-12 12:26:08
#include<iostream>
using namespace std ;
int main(){
int n,i,h=0;
cin>>n ;
for(i=1 ; i<=n ; i++)
{
h=h+i*(i+1);

}
cout<< h ;
return 0 ;
}//by jaja
2024-11-24 18:20:56
#include <iostream>
using namespace std;
int main() {
int n,i,b=0,j;
cin>>n;
for(i=1;i<=n;i++){
b=b+(i*(i+1));
}cout<<b;
}
sn yrih yum bol 4r angiin huuhed bodno shuu neeree
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.