ASC(22)H(大数+推公式)
High Speed Trains
Problem Description
The kingdom of Flatland has n cities. Recently the king of Flatland visited Japan and was amazed by high speed trains Shinkansens going all around the country. Therefore he decided to build the system of high
speed trains in Flatland.
Each high speed train line will be bidirectional and connect exactly two different cities of Flatland. Although there is actually no need of high speed trains in Flatland, the king ordered that there must
be at least one high speed train line from each city of Flatland.
The minister of transportation told the king that there are several train system satisfying his requirements. The king was amazed by the fact and asked the minister to count the number of possible systems.
Help the minister to calculate the number of train systems.
Input
Output
Sample Input
4
Sample Output
41
ASC(22)H(大数+推公式)的更多相关文章
- HDU 4873 ZCC Loves Intersection(JAVA、大数、推公式)
在一个D维空间,只有整点,点的每个维度的值是0~n-1 .现每秒生成D条线段,第i条线段与第i维度的轴平行.问D条线段的相交期望. 生成线段[a1,a2]的方法(假设该线段为第i条,即与第i维度的轴平 ...
- sgu495:概率dp / 推公式
概率题..可以dp也可以推公式 抽象出来的题目大意: 有 n个小球,有放回的取m次 问 被取出来过的小球的个数的期望 dp维护两个状态 第 i 次取出的是 没有被取出来过的小球的 概率dp[i] 和 ...
- hdu4507 数位dp+推公式
推公式的能力需要锻炼.. /* dp的时候要存结构体 里面三个元素: cnt,就是满足条件的个数 sum1,就是满足条件的数字和 sum2,满足条件的数字平方和 推导过程:还是用记忆化搜索模板 dp[ ...
- 2017多校第7场 HDU 6128 Inverse of sum 推公式或者二次剩余
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6128 题意:给你n个数,问你有多少对i,j,满足i<j,并且1/(ai+aj)=1/ai+1/a ...
- SGU 495 Kids and Prizes:期望dp / 概率dp / 推公式
题目链接:http://acm.sgu.ru/problem.php?contest=0&problem=495 题意: 有n个礼物盒,m个人. 最开始每个礼物盒中都有一个礼物. m个人依次随 ...
- hdu6061[NTT推公式] 2017多校3
/*hdu6061[NTT推公式] 2017多校3*/ #include <bits/stdc++.h> using namespace std; typedef long long LL ...
- HDU6050: Funny Function(推公式+矩阵快速幂)
传送门 题意 利用给出的式子求\(F_{m,1}\) 分析 直接推公式(都是找规律大佬) \(n为偶数,F_{m,1}=\frac{2(2^n-1)^{m-1}}3\) \(n为奇数,F_{m,1}= ...
- 【BZOJ1426】收集邮票 概率DP 论文题 推公式题
链接: #include <stdio.h> int main() { puts("转载请注明出处[辗转山河弋流歌 by 空灰冰魂]谢谢"); puts("网 ...
- HDU 4870 Rating(概率、期望、推公式) && ZOJ 3415 Zhou Yu
其实zoj 3415不是应该叫Yu Zhou吗...碰到ZOJ 3415之后用了第二个参考网址的方法去求通项,然后这次碰到4870不会搞.参考了chanme的,然后重新把周瑜跟排名都反复推导(不是推倒 ...
随机推荐
- 简单浮点数除法模拟-hdu-4493-Tutor
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4493 题目意思: 给小数点后两位的12个月的工资,求出平均工资,输出离小数点后第二位最近的两位小数, ...
- Maven--构建企业级仓库(二)
<Maven--搭建开发环境(一)> <Maven--构建企业级仓库(二)> <Maven—几个需要补充的问题(三)> 看到经历的两家公司 ...
- log4j:ERROR Could not find value for key log4j.appender.error
我是在rootLogger末尾增加R就好了. 终于我的配置环境例如以下: #设置日志的级别 ,多个以,分开(没有给出的,则不会被输出) log4j.rootLogger=info,error,R #D ...
- ITextSharp 初次接触
官网:http://www.itextpdf.com/ (英文好的建议看这里) 下面我就对itextsharp做一个初步的介绍,并把最近封装的一个用于生成pdf的类库提供给需要的朋友,对于大神你可以 ...
- HTML5新标签
<article>标签定义外部的内容.比如来自一个外部的新闻提供者的一篇新的文章,或者来自 blog 的文本,或者是来自论坛的文本.亦或是来自其他外部源内容. HTML5:<arti ...
- 高质量程序设计指南C/C++语言——C++/C程序设计入门(3)
- iOS XMPP之常见错误一:(<failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>)
在XMPP开发中,使用XMPPStream进行连接服务器后,验证过程中,比较常见的一个错误是 <failure xmlns="urn:ietf:params:xml:ns:xmpp-s ...
- createObjectURL方法 实现本地图片预览
ie6 可以直接显示本本地路径的图片 如: <img src="file://c:/3.jpg" /> ~~~网上都说ie7就不支持这种文件系统路径的url,但测试 ...
- Impossible WPF Part 2: Binding Expressions
原文 http://www.11011.net/wpf-binding-expressions Back in April I posted an idea for building an expre ...
- nginx区分手机与电脑浏览器并进入相应站点
本文要讲的的是如何使用nginx区分pc和手机访问不同的网站,是物理上完全隔离的两套网站(一套移动端.一套pc端),这样带来的好处pc端和移动端 的内容可以不一样,移动版网站不需要包含特别多的内容,只 ...