Primary School Olympiad (lower) Time limit:1000ms Memory limit:65536k have questions? Dot here ^_^ The title of the Summer, the ACM Association of Welfare, a lot of watermelon, clever Xiao Ming is very fond of thinking, a watermelon, n knife can be cut into several points? Can you help him out? Enter multiple sets of inputs, one for each group, until the end of the file. Enter an n (0≤n≤100). Output for each set of inputs, output a single number, n knives can cut the watermelon into several parts. Sample input
123
Sample output
248
Hint Source sample Program
#include <iostream> #include <algorithm> #include <stdio.h> #include <stdlib.h> #include < String.h> #include <math.h>using namespace Std;int main () { int a[110]; for (int i=0;i<=101;i++) { A[i] = (i*i*i + 5*i)/6 + 1; } int n; while (scanf ("%d", &n)!=eof) { printf ("%d\n", A[n]); }
Sdut 2867 Primary Olympiad (Lower) (regular)