1138

来源:互联网 发布:丹尼斯约翰逊数据 编辑:程序博客网 时间:2024/06/02 18:16
[提交][状态][讨论版]

题目描述

Alice, Kate and Susan are sisters. One day, their parents went to work and left them home. They had nothing to do at home besides eating candy. So their mother also left them with N candies. Each of them can eat some candies, but the total number cannot be more than N. It’s allowed that someone eat nothing. By given N, your task is to determine how many different ways they take candies.

输入

Just only one integer N and 0<=N<=3000.

输出

Print the number of such ways.

样例输入

13

样例输出

420

提示

来源

2012.03


#include<stdio.h>int main(){    long long i,n,num=0;    while(scanf("%lld",&n)!=EOF)    {for(i=1;i<=n+1;++i)    num+=i*(i+1)/2;    printf("%lld\n",num);    num=0;}    return 0;}

0 0