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 is 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 t o A certain number that's proportional to the intellectual level of the player. To make special sets, the same principle as for standard Domino sets are Used:each bone has both ends; On each end there is several dots (from zero up to a given number); A set contains bones with all possible combinations of ends; There is no-equal bones (there is no-distinction with respect-left or right ends, so, for example, Bones 2-5 and 5 -2 are considered equal). But, unlike ordinary dominoes, special bones is marked with dots that is not just strokes of paint but real 10-carat dia Monds. How many diamonds is needed to produce one special domino set? Inputthe input contains The maximal number of dots on one end of a domino bone (1≤
N≤10000). Outputoutput the number of diamonds used for producing the domino set. Sample
problem Author:Folklore. Adapted by Stanislav Vasilyev
problem Source:Quarter-final of XXXI ACM icpc-yekaterinburg-2006
Parse: ans = n * (n + 1) * (n + 2)/2.
AC Code:
#include <bits/stdc++.h>using namespace Std;int main () { long long n; while (~SCANF ("%lld", &n)) { printf ("%lld\n", N (+ 1)/2 * (n + 2)); } return 0;}
URAL 1502. Domino Dots (rule-finding)