URAL 1502. Domino Dots (找规律)

1502. Domino Dots

Time limit: 0.5 second
Memory limit: 64 MB
In order to run huge capitals, New Russians need exceptional brains. Of course, with such workload, they also need peculiar relaxation methods. In casinos there are special domino sets for New Russians. In these sets, the number of dots on each end varies not from zero to six, as in sets for ordinary people, but from zero to a certain number that is proportional to the intellectual level of the player. To make special sets, the same principle as for standard domino sets is used: each bone has two ends; on each end there are several dots (from zero up to a given number); a set contains bones with all possible combinations of ends; there are no two equal bones (there is no distinction with respect to left or right ends, so, for example, bones 2-5 and 5-2 are considered equal). But, unlike ordinary dominoes, special bones are marked with dots that are not just strokes of paint but real 10-carat diamonds.
How many diamonds are needed to produce one special domino set?

Input

The input contains the maximal number of dots on one end of a domino bone (1 ≤ N ≤ 10000).

Output

Output the number of diamonds used for producing the domino set.

Sample

inputoutput
2
12
Problem Author: Folklore. Adapted by Stanislav Vasilyev
Problem Source: Quarter-Final of XXXI ACM ICPC - Yekaterinburg - 2006




解析:ans = n * (n + 1) * (n + 2) / 2.




AC代码:

#include <bits/stdc++.h>
using namespace std;

int main(){
    long long n;
    while(~scanf("%lld", &n)){
        printf("%lld\n", n*(n + 1) / 2 * (n + 2));
    }
    return 0;
}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值