HDU1502 动态规划计数 高精度
来源:互联网 发布:gal gadot 知乎 编辑:程序博客网 时间:2024/05/20 18:48
Regular Words
Time Limit: 2000/1000 MS(Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 379 Accepted Submission(s): 169
Problem Description
Consider words of length 3n over alphabet {A, B, C} .Denote the number of occurences of A in a word a as A(a) , analogously let thenumber of occurences of B be denoted as B(a), and the number of occurenced of Cas C(a) .
Let us call the word w regular if the following conditions are satisfied:
A(w)=B(w)=C(w) ;
if c is a prefix of w , then A(c)>= B(c) >= C(c) .
For example, if n = 2 there are 5 regular words: AABBCC , AABCBC , ABABCC ,ABACBC and ABCABC .
Regular words in some sense generalize regular brackets sequences (if weconsider two-letter alphabet and put similar conditions on regular words, theyrepresent regular brackets sequences).
Given n , find the number of regular words.
Input
There are mutiple cases in the input file.
Each case contains n (0 <= n <= 60 ).
There is an empty line after each case.
Output
Output the number of regular words of length 3n .
There should be am empty line after each case.
Sample Input
2
3
Sample Output
5
42
动态规划计数+高精度,不懂写Java大数,杯具了好久.
- HDU1502 动态规划计数 高精度
- hdu1502 Regular Words 动态规划 高精度 打表
- 串的计数--动态规划和高精度
- 树形动态规划 hdu1502 poj2342 Anniversary party
- 字符串计数(动态规划)
- 动态规划----计数问题
- 过河卒-动态规划+高精度
- HDU1502_Regular Words动态规划+高精度
- hdu1502 Regular Words 【dp+高精度加法】
- 【jzoj4630】【计数】【数位动态规划】
- hdu1502
- hdu1502
- ☆逆序对 动态规划+高精度
- 10069 - Distinct Subsequences(高精度+动态规划)
- [动态规划+高精度] 矩阵取数游戏
- USCAO 4.3.1 buylow 动态规划-高精度
- noip2000乘积最大 (高精度,动态规划)
- FATE-HDU-2159-动态规划 计数法
- HDU1501 记忆化搜索
- 子衿的事(4)
- switch 语句的参数类型
- Windows系统下MySQL的常用命令解析
- linux install fcitx
- HDU1502 动态规划计数 高精度
- 周五回顾,找到三件做的好以及三件需要改善的事情
- java TimeTask类
- asdf
- 51单片机独立按键抖动演示及软件消抖
- 关于ARM的一些概念
- 1 PostMessage 和 SendMessage的区别
- HDU1503 最长公共子串
- Surface添加纹理失败: