1 solutions
-
0
C++ :
#include <stdio.h> #include <string.h> int n; int main(){ //freopen("data.in","r",stdin); //freopen("data1.out","w",stdout); while(scanf("%d",&n) != EOF){ /*int m = n+1; int ans = 0; for(int i = 0; i <= n; i++){ if(i == 0) ans += m * (m-1) / 2; else ans += m * (m-1); m -= 1; } printf("%d\n",ans);*/ // sigma(n^2); printf("%d\n",n*(n+1)*(2*n+1)/6); } return 0; }
- 1
Information
- ID
- 18170
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By