TOJ4203: Domino Piece
4203: Domino Piece 
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
这个题挺好玩的,我列出所有排列吧,第一行可以是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的更多相关文章
- SGU 101.Domino( 欧拉路径 )
求欧拉路径...直接dfs即可,时间复杂度O(N) -------------------------------------------------------------------------- ...
- SGU 101 Domino (输出欧拉路径)
101. Domino time limit per test: 0.25 sec. memory limit per test: 4096 KB Dominoes – game played wit ...
- ACM: SGU 101 Domino- 欧拉回路-并查集
sgu 101 - Domino Time Limit:250MS Memory Limit:4096KB 64bit IO Format:%I64d & %I64u Desc ...
- SGU101
Dominoes – game played with small, rectangular blocks of wood or other material, each identified by ...
- Codeforces Gym 100500F Problem F. Door Lock 二分
Problem F. Door LockTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/at ...
- sgu101 欧拉路径 难度:1
101. Domino time limit per test: 0.25 sec. memory limit per test: 4096 KB Dominoes – game played wit ...
- sgu101-欧拉回路
101. Domino time limit per test: 0.25 sec. memory limit per test: 4096 KB Dominoes – game played wi ...
- CF 405B Domino Effect(想法题)
题目链接: 传送门 Domino Effect time limit per test:1 second memory limit per test:256 megabytes Descrip ...
- BPM Domino集成解决方案
一.需求分析 Lotus Notes/Domino是IBM的协同办公平台,在国内有广泛的用户. 但由于推出年头较早.采用文档数据库等特点, 导致其流程集成能力弱.统计分析难.不支持移动办公等问题,很多 ...
随机推荐
- UOJ#7 NOI2014 购票 点分治+凸包二分 斜率优化DP
[NOI2014]购票 链接:http://uoj.ac/problem/7 因为太麻烦了,而且暴露了我很多学习不扎实的问题,所以记录一下具体做法. 主要算法:点分治+凸包优化斜率DP. 因为$q_i ...
- unity热更新方案对比
Unity应用的iOS热更新 • 什么是热更新 • 为何要热更新 • 怎样在iOS 上对Unity 应用进行热更新 • 支持Unity iOS 热更新的各种Lua 插件的对照 什么是热更新 • ...
- xcdatamodel的实质
修改后缀名为zip或者其它,可以查看到xcdatamodel是一个描述文件 <?xml version="1.0" encoding="UTF-8" st ...
- 动态代理--Cglib
JDK 的Proxy 实现,需要代理对象实现接口: package com.utils; import java.lang.reflect.InvocationHandler; import java ...
- 第三单元OO总结
- java基础——冒泡排序
最近开始准备面试,所以将Java基础复习一遍,又学习了冒泡排序 冒泡排序的基本思想是,对相邻的元素进行两两比较,顺序相反则进行交换,这样,每一趟会将最小或最大的元素“浮”到顶端,最终达到完全有序 ja ...
- JavaScript中数组的使用
---恢复内容开始--- 创建数组 1,通过 var arr1 = [1,2,3] 2通过使用 var arr2 = new Array(1,2,3) 在这里创造的数组实际上都是一个对象,然后把对象的 ...
- 转 Hystrix入门指南 Introduction
https://www.cnblogs.com/gaoyanqing/p/7470085.html
- JS - encodeURI与encodeURIComponent的区别
encodeURI(String)主要用于整个URI(例如,http://www.jxbh.cn/illegal value.htm),而encodeURIComponent(String)主要用于对 ...
- mysql命令行复制数据库
为了方便快速复制一个数据库,可以用以下命令将db1数据库的数据以及表结构复制到newdb数据库创建新的数据库#mysql -u root -p123456 mysql>CREATE DATABA ...