URAL 1502. Domino Dots (rule-finding)

Source: Internet
Author: User

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
input Output
2
12
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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.