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的协同办公平台,在国内有广泛的用户. 但由于推出年头较早.采用文档数据库等特点, 导致其流程集成能力弱.统计分析难.不支持移动办公等问题,很多 ...
随机推荐
- 修复使用<code>XmlDocument</code>加载含有DOCTYPE的Xml时,加载后增加“[]”字符的错误
C# LINQ TO XML - Remove “[]” characters from the DTD header http://stackoverflow.com/questions/12358 ...
- hadoop的shell总结
ls命令(文件内容) 列出系统跟目录下的目录和文件 Hadoop fs -ls / 列出文件系统所有的目录和文件 Hadoop fs -ls -R / cat命令(列出文档内容) Hadoop fs ...
- Python3+Selenium3+webdriver学习笔记7(选择多链接的结果、iframe、下拉框)
#!/usr/bin/env python# -*- coding:utf-8 -*- from selenium import webdriverfrom selenium.webdriver.co ...
- Tomcat控制台乱码问题
乱码效果图 解决办法 1.修改cmd的编码格式 快捷键win+R打开运行程序,输入regedit打开注册表,找到以下路劲并且修改. [HKEY_LOCAL_MACHINE\SOFTWARE\Micro ...
- HDU 4055 The King’s Ups and Downs(DP计数)
题意: 国王的士兵有n个,每个人的身高都不同,国王要将他们排列,必须一高一矮间隔进行,即其中的一个人必须同时高于(或低于)左边和右边.问可能的排列数.例子有1千个,但是最多只算到20个士兵,并且20个 ...
- 一把剪刀看懂git reset 和它的三个参数
都说git 命令难记且难懂,但是如果从立体的角度看待git与git管理的版本,那么一切都会明朗许多. 大多数的学习教程为了理解git,会绘制几个圆圈的串联,每个圆圈代表一个commit的版本,也就是从 ...
- GWTDesigner_v5.1.0破解码
GWTDesigner_v5.1.0_win32_x86.exe破解码,双击运行keygeno.jar,然后输入用户名.网卡MAC,然后单击Generate,将生成的文件放在C:\Documents ...
- MySql面试题、知识汇总、牛客网SQL专题练习
点击名字直接跳转到链接: Linux运维必会的100道MySql面试题之(一) Linux运维必会的100道MySql面试题之(二) Linux运维必会的100道MySql面试题之(三) Linux运 ...
- Java Object类 instanceof关键字 练习:判断是否为同一人 集合按照人的年龄排序,如果年龄相同按名字的字母顺序升序 Comparator比较器
package com.swift; public class Same_Person_Test { public static void main(String[] args) { /* * Obj ...
- ios下通过webservice获取数据
经历了两天的摸索,终于成功获取了数据,因为公司要做一个停车入库的信息查询,所以需要访问webservice的接口,由于没有接触过webservice,所以第一天就是各种搜索资料,类库,各种尝试,甚至是 ...