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. centos 离线安装 mysql 5.7

    1 . 安装新版mysql前,需将系统自带的mariadb-lib卸载. rpm -qa|grep mariadb mariadb-libs--.el7.centos.x86_64 rpm -e -- ...

  2. selenium3+webdriver学习笔记1(访问常用请求)

    #!/usr/bin/env python# -*- coding:utf-8 -*- from selenium import webdriverimport osimport time url1= ...

  3. VC-基础:vs2010快捷键

    F12: 转到所调用过程或变量的定义 CTRL + SHIFT + B生成解决方案 CTRL + F7 生成编译 CTRL + O 打开文件 CTRL + SHIFT + O打开项目 CTRL + S ...

  4. js判断是否为app

    var ua = navigator.userAgent; var isapp = ua.match("lenovomallapp") == null ? 0 : 1;

  5. scanf()的使用

    scanf函数称为格式输入函数,即按用户指定的格式从键盘上把数据输入到指定的变量之中. 如下面代码: #include<stdio.h> int main() { int a,b; sca ...

  6. C#4.0中的dynamic关键字和ExpandoObject对象

    dynamic最大的特点我想莫过于在它的类型在运行时才确定,这也是它与往静态类型关键字的最大区别.如果你在你的代码操作中用到了dynamic关键字去定义一个变量时,那么这个变量在编译的时候编译器不会对 ...

  7. Linux运维笔记--第一部

                                 CentOS 学习总结                                                             ...

  8. lua 使用正则表达式分割字符串

    function string_split(str, delimiter) if str == nil or str == '' or delimiter == nil then  return ni ...

  9. k8s的flannel网络插件配置

    flannel的网络插件配置 Kubernetes网络通信需要解决以下问题:            (1)容器间通信:同一个Pod内的多个容器间的通信,lo            (2)Pod通信:P ...

  10. ubuntu下RedisDesktopManager的安装,redis可视化工具

    官方网站:https://redisdesktop.com/download 一句命令行解决: sudo snap install redis-desktop-manager 或者直接通过软件管理中心 ...