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

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;
}
时间: 2025-01-18 14:27:57

URAL 1502. Domino Dots (找规律)的相关文章

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 Ru

URAL 2070 Interesting Numbers (找规律)

题意:在[L, R]之间求:x是个素数,因子个数是素数,同时满足两个条件,或者同时不满足两个条件的数的个数. 析:很明显所有的素数,因数都是2,是素数,所以我们只要算不是素数但因子是素数的数目就好,然后用总数减掉就好.打个表,找找规律,你会发现, 这些数除外的数都是素数的素数次方,然后就简单了. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include &

URAL 2065 Different Sums (找规律)

题意:构造一个数列,使得它们的区间和的种类最少,其中数列中不同的数的数目不少于k. 析:我们考虑0这个特殊的数字,然后0越多,那么总和种类最少,再就是正负交替,那么增加0的数量. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath&g

URAL 1295. Crazy Notions(数学啊 &amp; 找规律)

题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1295 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 th

The Cow Lineup_找规律

Description Farmer John's N cows (1 <= N <= 100,000) are lined up in a row.Each cow is labeled with a number in the range 1...K (1 <= K <=10,000) identifying her breed. For example, a line of 14 cows might have these breeds: 1 5 3 2 5 1 3 4 4

UVA - 1646 - Edge Case(找规律)

题意:n(3 <= n <= 10000)个结点组成一个圈,求匹配(即没有公共点的边集)的个数. 找规律为斐波那契的性质,因为数太大所以用的java大数. import java.math.BigInteger; import java.util.Scanner; public class Main{ public static int MAXN = 10000 + 10; public static BigInteger []c = new BigInteger[MAXN]; public

【55测试】【字符串】【栈】【找规律】

集训第二天,额,考崩了. 第一题 hao 大意:(这个名字就不要在意了,其实是祖玛游戏) 模拟祖玛游戏的模式,给一个'A'~'Z'的字符串,然后有t个插入操作为 “ 添加后的在原字符串的位置 x  插入元素 c ”,字符串中有超过或等于 3 个相同的字符,则被消除,输出每次操作后剩余的字符串,如果为空,则输出“-”. 样例: ACCBA                     输出:  ABCCBA 5   AABCCBA 1 B AABBCCBA 0 A - 2 B A 4 C 0 A 解:

2016(胡赛复现)_大数找规律

Time Limit: 5 Sec  Memory Limit: 128 MB Description 给出正整数 n 和 m,统计满足以下条件的正整数对 (a,b) 的数量: 1. 1≤a≤n,1≤b≤m;  2. a×b 是 2016 的倍数. Input 输入包含不超过 30 组数据. 每组数据包含两个整数 n,m (1≤n,m≤109). Output 对于每组数据,输出一个整数表示满足条件的数量. Sample Input 32 63 2016 2016 1000000000 1000

HDU 5703 Desert 水题 找规律

已知有n个单位的水,问有几种方式把这些水喝完,每天至少喝1个单位的水,而且每天喝的水的单位为整数.看上去挺复杂要跑循环,但其实上,列举几种情况之后就会发现是找规律的题了= =都是2的n-1次方,而且这题输出二进制数就行了......那就更简单了,直接输出1,然后后面跟n-1个0就行了╮(╯_╰)╭ 下面AC代码 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm>