URAL 1502. Domino Dots(数学)

题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1502

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

input output
2
12

题意:

告诉你一个数n,然后你有多种的多米诺骨牌.

例如当n = 2时,你拥有的多米诺骨牌

就会有00, 01, 02, 11, 12, 22 这 6 种骨牌.那么需要0+0+0+1+0+2+1+1+1+2+2+2这样12颗宝石

可以发现,每个数出现的次数时一样的

每个数出现的次数为n+2;

从0加到n的和为(0+n)(n+1)/2,

那么答案就是n*(n+1)/2*(n+2).

代码如下:

#include <cstdio>
int main()
{
    LL n;
    while(~scanf("%I64d",&n))
    {
        LL ans = n*(n+1)/2*(n+2);
        printf("%I64d\n",ans);
    }
    return 0;
}
时间: 2024-07-29 23:50:33

URAL 1502. Domino Dots(数学)的相关文章

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

URAL 2003. Simple Magic(数学啊 )

题目链接:http://acm.timus.ru/problem.aspx?space=1&num=2003 2003. Simple Magic Time limit: 1.0 second Memory limit: 64 MB Do you think that magic is simple? That some hand-waving and muttering incomprehensible blubber is enough to conjure wonderful garden

URAL 1515. Cashmaster (数学啊 )

题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1515 Background Once upon a time former petty bureaucrat, nowadays the Minister of Finance of the Soviet Federation, Victor Thiefton considered, that he had stolen so much money during the first half

URAL 1718 . Rejudge(数学啊 )

题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1718 1718. Rejudge Time limit: 0.5 second Memory limit: 64 MB At three o'clock in the morning Sasha (aka Sandro) discovered that there were only seven tests for one of the problems in the first volume

URAL 1295 Crazy Notions 数学 找规律

1295. Crazy Notions Time limit: 0.5 second Memory limit: 64 MB For five days robot-loader JK546L54p has been buried under the thick layer of the Sibelian plutonium slag. The terrible strike of the atmospheric electricity has led to the depressurizati

URAL 2047 Maths (数学)

对于一个数来说,它的除数是确定的,那么它的前驱也是确定的,而起点只能是1或2,所以只要类似筛法先预处理出每个数的除数个数 ,然后递推出每个数往前的延伸的链长,更新最大长度,记录对应数字.找到maxn以后,根据最后一个数找到前驱,并记录到ans数组中. 代码来自队友 #include<stdio.h> #include<string.h> #include<math.h> #include<algorithm> #include<vector> #

URAL 1823. Ideal Gas 数学,分类

1823. Ideal Gas Time limit: 0.5 second Memory limit: 64 MB Many of you know the universal method of solving simple physics problems: you have to find in a textbook an identity in which you know the values of all the quantities except for one, substit

URAL 1826. Minefield(数学啊 递归)

题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1826 1826. Minefield Time limit: 0.5 second Memory limit: 64 MB To fulfill an assignment, a reconnaissance group of n people must cross the enemy's minefield. Since the group has only one mine detecto

URAL 1731. Dill(数学啊 )

题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1731 1731. Dill Time limit: 0.5 second Memory limit: 64 MB Ivan Vasil'evich likes to work in his garden. Once he heard that dill was a very beautiful and healthy crop and planted his whole garden with