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.|

RGB7071 - Нийлбэр 2

Өгөгдсөн n тоо хүртэлх квадратуудын нийлбэрийг ол. Давталт ашиглахгүй болно.

12+22+...+n2

Input

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

Output

Нийлбэр

Example

Input:
5

Output:
55

Нэмсэн:Bataa
Огноо:2013-01-06
Хугацааны хязгаарлалт: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-10-19 13:39:04
#include <cstdio>
int main()
{
int a;
scanf ("%d",&a);
int n=a*(a+1)*(2*a+1)/6;
printf ("%d",n);
return 0;
}
2019-10-10 14:43:18
HAH

Last edit: 2019-10-10 14:43:41
2019-05-31 12:45:08
#include<stdio.h>
#include<string.h>
int main()
{
int a,b,c=0;
scanf("%d", &a);
for(b=1;b<=a;b++) {
c=c+b*b; }
printf("%d",c);
}
2019-03-18 11:46:01
//Bodoltoo uldeelee
#include<stdio.h>
#include<math.h>
main(){
int a, b, c, d;
scanf("%d", &a);
d=(a+1)*(2*a+1)*a/6;
printf("%d", d);
}
2019-01-29 10:58:14
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main (){
int n,s;
scanf("%d",&n);
s=(n+1)*(2*n+1)*n/6;
printf("%d",s);

return 0;
}
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.