题意:从坐标(0, 0)到(n, 0)的折线,这条折线每向右延伸一个单位长度,高度要么不变,要么+1,要么-1,(不能到y=0以下)已知n,求这种折线种数
思路:我们知道上升和下降的次数要一样,而这就像卡特兰数的入栈出栈次序一样,所以我们从n中选出2k次进行类出栈模拟,
那么ans[k] = C[n][2k]*C[2k][k]/(k+1),计算组合数n^2会T,然后我们可以相除ans[k-1] = C[n][2k-2]*C[2k-2][k-1]/(k)
两式递推出结果是ans[k] = ans[k-1]*(n-2*k+2)*(n-2*k+1)/(k*(k+1)) 

import java.math.BigInteger;
import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int n;while(sc.hasNext()){n = sc.nextInt();BigInteger ans = BigInteger.ONE;BigInteger tmp = BigInteger.ONE;for(int i = 1; i <= n/2; i++){tmp = tmp.multiply(BigInteger.valueOf((n-2*i+1)*(n-2*i+2))).divide(BigInteger.valueOf(i*(i+1)));ans = ans.add(tmp);}System.out.println(ans.mod(BigInteger.TEN.pow(100)));}}}

Delta Wave

Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1230    Accepted Submission(s): 398
Problem Description
A delta wave is a high amplitude brain wave in humans with a frequency of 1 – 4 hertz which can be recorded with an electroencephalogram (EEG) and is usually associated with slow-wave sleep (SWS).
-- from Wikipedia

The researchers have discovered a new kind of species called "otaku", whose brain waves are rather strange. The delta wave of an otaku's brain can be approximated by a polygonal line in the 2D coordinate system. The line is a route from point (0, 0) to (N, 0), and it is allowed to move only to the right (up, down or straight) at every step. And during the whole moving, it is not allowed to dip below the y = 0 axis.

For example, there are the 9 kinds of delta waves for N = 4:

Given N, you are requested to find out how many kinds of different delta waves of otaku.

Input
There are no more than 20 test cases. There is only one line for each case, containing an integer N (2 < N <= 10000)
Output
Output one line for each test case. For the answer may be quite huge, you need only output the answer module 10100.
Sample Input
3 4
Sample Output
4 9

HDU 3723 Delta Wave(卡特兰数+大数)相关推荐

  1. HDU 3723 Delta Wave

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3723 Delta Wave Time Limit: 6000/3000 MS (Java/Others ...

  2. HDU 3723 Delta Wave(默慈金数)

    传送门 Delta Wave Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) T ...

  3. HDU3723 Delta Wave —— 卡特兰数

    题目链接:https://vjudge.net/problem/HDU-3723 Delta Wave Time Limit: 6000/3000 MS (Java/Others)    Memory ...

  4. hdu 1134 卡特兰数(大数模板)

    卡特兰数 递推公式: C(n)=C(2n,n)/(n+1)  即用数组表示为c[i]=c[i-1]*(4*i-2)/(i+1); 一般形式 直接 表达 c[1]=1; for(i=2;i<40; ...

  5. HDOJ 3723 Delta Wave

    网上抄的,Java的大数运算. 第一次提交JAVA的程序 Delta Wave Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 3276 ...

  6. HDOJ/HDU 1133 Buy the Ticket(数论~卡特兰数~大数~)

    Problem Description The "Harry Potter and the Goblet of Fire" will be on show in the next ...

  7. zcmu-1934(卡特兰数大数取模(逆元))

    1934: ly的二叉树 Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 42  Solved: 9 [Submit][Status][Web Boar ...

  8. 卡特兰数 (hdu3723 Delta Wave)

    初次接触组合数学,比赛做到了卡特兰数,看了看大牛的博客,算是初步了解了一下 dalao博客:http://www.cppblog.com/MiYu/archive/2010/08/07/122573. ...

  9. hdu 1023 大数 卡特兰数

    卡特兰数 JAVA大数 import java.util.*; import java.math.*; public class Main {public static void main(Strin ...

最新文章

  1. 如何在C ++中从容器中删除元素
  2. windos 2008 vista 下的端口范围改变
  3. c语言用getchar函数输入两个字符c1,c语言:用getchar函数读入两个字符给c1,c2,用putchar和printf输出。思考问题...
  4. AI将成科学家“高级定制”工具
  5. 1、操作系统基础概念
  6. 计算机二级vb和vba,读取本机硬件信息的VBA代码
  7. Spring Boot——[java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration]解决方案
  8. net.sf.ehcache.util.UpdateChecker
  9. ASP.NET Core 用户注册 - ASP.NET Core 基础教程 - 简单教程,简单编程
  10. 【转】Android自动化测试(UiAutomator)简要介绍
  11. 深入浅出MySQL全文 下载
  12. C#/.NET 通过代码一键清理IE缓存文件/强制重置IE设置
  13. iOS逆向(什么是越狱?)
  14. 为何需要代码签名证书? 有了代码签名有什么不同?
  15. JAVA基础-多线程中锁机制
  16. CTFSHOW-WEB详解
  17. Dell服务器电源配置规则
  18. 如何通俗易懂地阐述机器学习?
  19. python南宁培训
  20. 女孩,既要懂得暧昧,又要懂得拒绝 【20cn 依依】

热门文章

  1. RestTemplate 详解
  2. 研华数据采集板卡驱动包Xnavi离线包制作教程
  3. logisim元件清单
  4. 团队梯队人才培养模型,60页人才梯队建设与人才培养
  5. 不花钱使用google keyword planner(关键字规化器)
  6. 什么是Essay和Article?
  7. 运动控制系统之调速系统
  8. 进击的巨人,进击的microbit(硬件选择)
  9. matplotlib之pyplot模块——绘制箱线图(盒须图)boxplot()(二)演示外观参数、返回值
  10. 浮点数加减丢失精度原因剖析