4203: Domino Piece 

Time Limit(Common/Java):1000MS/3000MS     Memory Limit:65536KByte
Total Submit: 55            Accepted:41

Description

Dominoes are gaming pieces used in numerous tile games. Each doimno piece contains two marks. Each mark consists of a number of spots (possibly zero).
The number of spots depends on the set size. Each mark in a size N domino set can contain between 0 and N spots, inclusive. Two tiles are considered identical if their marks have the same number of spots, irregardles of reading order. For example tile with 2 and 8 spot marks is identical to the tile having 8 and 2 spot marks. A proper domino set contains no duplicate tiles. A complete set of size N contains all posible tiles with N or less spots and no duplicate tiles. For example, the complete set of size 2 contains 6 tiles:

Write a program that will determine the total number of spots on all tiles of a complete size N set.

Input

The first and only line of input contains a single integer, N (1 ≤ N ≤ 1000), the size of the complete set.

Output

The first and only line of output should contain a single integer, total number of spots in a complete size N set.

Sample Input

3

Sample Output

12

Source

TOJ

这个题挺好玩的,我列出所有排列吧,第一行可以是0-n,对应下一行可以是0-n,这个第一行0-n的都要出现n+1次,上下相同的要除去,所以直接n*(n+1)(n+2)/2

#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
printf("%d",n*(n+)/*(n+));
}

TOJ4203: Domino Piece的更多相关文章

  1. SGU 101.Domino( 欧拉路径 )

    求欧拉路径...直接dfs即可,时间复杂度O(N) -------------------------------------------------------------------------- ...

  2. SGU 101 Domino (输出欧拉路径)

    101. Domino time limit per test: 0.25 sec. memory limit per test: 4096 KB Dominoes – game played wit ...

  3. ACM: SGU 101 Domino- 欧拉回路-并查集

    sgu 101 - Domino Time Limit:250MS     Memory Limit:4096KB     64bit IO Format:%I64d & %I64u Desc ...

  4. SGU101

    Dominoes – game played with small, rectangular blocks of wood or other material, each identified by ...

  5. Codeforces Gym 100500F Problem F. Door Lock 二分

    Problem F. Door LockTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/at ...

  6. sgu101 欧拉路径 难度:1

    101. Domino time limit per test: 0.25 sec. memory limit per test: 4096 KB Dominoes – game played wit ...

  7. sgu101-欧拉回路

    101. Domino time limit per test: 0.25 sec.  memory limit per test: 4096 KB Dominoes – game played wi ...

  8. CF 405B Domino Effect(想法题)

    题目链接: 传送门 Domino Effect time limit per test:1 second     memory limit per test:256 megabytes Descrip ...

  9. BPM Domino集成解决方案

    一.需求分析 Lotus Notes/Domino是IBM的协同办公平台,在国内有广泛的用户. 但由于推出年头较早.采用文档数据库等特点, 导致其流程集成能力弱.统计分析难.不支持移动办公等问题,很多 ...

随机推荐

  1. 【Troubleshooting Case】Exchange Server 组件状态应用排错?

    在Exchange 2013中,引入了“服务器组件状态”的概念.服务器组件状态从运行环境的角度提供对组成Exchange Server的组件的状态的精细控制. 日常排错时,常常会把Exchange 服 ...

  2. java uuid第一次性能

    在java中产生uuid的方式是使用java.util.UUID. UUID.randomUUID().toString(); 我在测试redis性能时,使用uuid产生测试数据,发现多线程测试red ...

  3. 似水流年 ? Chrome调试大全

    http://www.360doc.com/content/12/1107/20/7851074_246467307.shtml   作为一名前端开发者,打交道最多的可能是和浏览器.市面上各种浏览器多 ...

  4. [dp]uestc oj E - 菲波拉契数制

    E - 菲波拉契数制 Time Limit: 3000/1000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others) Submi ...

  5. MySQL基础教程——创建数据库并插入数据

    本节将介绍 MySQL 新建数据库,新建表,插入数据以及基本数据类型的相关知识.本节实验将创建一个名为 mysql_shiyan 的数据库,其中有两张表 employee和 department. 1 ...

  6. 关于tomcat的classloader的一点想法

    关于tomcat的classloader相关的帖子网上非常多,我觉得比较好的有: https://www.jianshu.com/p/d90e4430b0b9 https://blog.csdn.ne ...

  7. Python 继承、派生、组合、接口、抽象类

    继承是一种是的关系,和组合对比,组合是一种有的关系,这两者都是解决代用重用问题的 继承 注意:继承不是遗传,在显示角度中,是通过对象抽象成类,再把这些类抽象成一个,就是父类.是自下而上的过程,在程序中 ...

  8. c#和Java中的抽象类

    应用场景:当父类中的方法不知道如何去实现的时候,可以考虑将父类写成抽象类,将方法写成抽象方法. 比如:描述一个图形.圆形. 矩形三个类.不管哪种图形都会具备计算面积与周长的行为,但是每种图形计算的方式 ...

  9. java基础——随机数问题

    /** * 要求:随机打印50个随机(4-10长度)的字符串,要求字符串包含的范围是所有的英文字母包含大小写和数字, * 按照编码顺序排序,每行打印4个,要求首字符对齐 * @author fanyu ...

  10. 理解JWT的使用场景和优劣

    理解JWT的使用场景和优劣 淘楼小能手 百家号04-2816:20 经过前面两篇文章<JSON Web Token - 在Web应用间安全地传递信息><八幅漫画理解使用JSON We ...