URAL 1502. Domino Dots (找規律),uraldots

來源:互聯網
上載者:User

URAL 1502. Domino Dots (找規律),uraldots

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?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




解析: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;}



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.