2018. The Debut Album

Time limit: 2.0 second
Memory limit: 64 MB
Pop-group “Pink elephant” entered on recording their debut album. In fact they have only two songs: “My love” and “I miss you”, but each of them has a large number of remixes.
The producer of the group said that the album should consist of n remixes. On second thoughts the musicians decided that the album will be of interest only if there are no more than a remixes on “My love” in a row and no more than b remixes on “I miss you” in a row. Otherwise, there is a risk that even the most devoted fans won’t listen to the disk up to the end.
How many different variants to record the album of interest from n remixes exist? A variant is a sequence of integers 1 and 2, where ones denote remixes on “My love” and twos denote remixes on “I miss you”. Two variants are considered different if for some i in one variant at i-th place stands one and in another variant at the same place stands two.

Input

The only line contains integers nab (1 ≤ ab ≤ 300; max(a,b) + 1 ≤ n ≤ 50 000).

Output

Output the number of different record variants modulo 109+7.

Sample

input output
3 2 1
4

Notes

In the example there are the following record variants: 112, 121, 211, 212.
Problem Author: Olga Soboleva (prepared by Alex Samsonov)
Problem Source: NEERC 2014, Eastern subregional contest
 
 
 

ural 2018 The Debut Album(dp¥)的更多相关文章

  1. Ural 2018The Debut Album(DP)

    题目地址:Ural 2018 简单DP.用滚动数组. 代码例如以下: #include <iostream> #include <cstdio> #include <st ...

  2. URAL 2018 The Debut Album (DP)

    题意:给出n长度的数列,其实1的连续个数不超过a,2的连续个数不超过b. 析:dp[i][j][k] 表示前 i 个数,以 j 结尾,并且连续了k个长度,要用滚动数组,要不然MLE. 代码如下: #p ...

  3. [小结] 中山纪念中学2018暑期训练小结(划掉)(颓废记)-Day10

    [小结] 中山纪念中学2018暑期训练小结(划掉)(颓废记)-Day10 各位看众朋友们,你们好,今天是2018年08月14日,星期二,农历七月初四,欢迎阅看今天的颓废联编节目 最近发生的灵异事件有 ...

  4. 取数字(dp优化)

    取数字(dp优化) 给定n个整数\(a_i\),你需要从中选取若干个数,使得它们的和是m的倍数.问有多少种方案.有多个询问,每次询问一个的m对应的答案. \(1\le n\le 200000,1\le ...

  5. 洛谷P2507 [SCOI2008]配对 题解(dp+贪心)

    洛谷P2507 [SCOI2008]配对 题解(dp+贪心) 标签:题解 阅读体验:https://zybuluo.com/Junlier/note/1299251 链接题目地址:洛谷P2507 [S ...

  6. [Codeforces722E] Research Rover (dp+组合数学)

    [Codeforces722E] Research Rover (dp+组合数学) 题面 给出一个N*M的方格阵,从(1,1)出发,到(N,M)结束,从(x,y)只能走到(x+1,y)或(x,y+1) ...

  7. Gym 100507G The Debut Album (滚动数组dp)

    The Debut Album 题目链接: http://acm.hust.edu.cn/vjudge/contest/126546#problem/G Description Pop-group & ...

  8. Ural 1635 Mnemonics and Palindromes(DP)

    题目地址:space=1&num=1635">Ural 1635 又是输出路径的DP...连着做了好多个了. . 状态转移还是挺简单的.要先预处理出来全部的回文串,tag[i] ...

  9. Rikka with Subset HDU - 6092 (DP+组合数)

    As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some mat ...

随机推荐

  1. element-UI的操作步骤steps每一项添加事件,比如click,hover

    简单来说,只添加click 和css :hover就好了 一.组件里 <el-steps :space="200" :active="1" finish- ...

  2. Js算两经纬度间球面距离

    function GetDistance( lat1, lng1, lat2, lng2){ var radLat1 = lat1 * Math.PI / 180.0 var radLat2 = la ...

  3. 一个Browser的HTTP请求(一)

    本文主要是分析一个简单的web服务器是如何工作的. 若有不恰当或不对之处,请指正! Tomcat和web服务器的关系 我们常说Tomcat是一个web容器,也常说用户通过浏览器向web服务器进行请求, ...

  4. (转)fiddler使用简介--其三

    原文地址:http://www.cnblogs.com/miantest/p/7294620.html 我们知道Fiddler是位于客户端和服务器之间的代理,它能够记录客户端和服务器之间的所有 HTT ...

  5. admin 模块功能

    class CustomModelAdmin(admin.ModelAdmin): def has_module_permission(self, request): 是否会显示model def h ...

  6. 字符编码 and 字节和字符串转换(待补充)

    ascii用一个字节(8位二进制)代表一个字符 Unicode常用2个字节(16位二进制)代表一个字符,生僻字需要用四个字节 汉字中已经超出了ASCII编码的范围,用Unicode, Unicode兼 ...

  7. 防止基本的XSS攻击 滤掉HTML标签

    /** * 防止基本的XSS攻击 滤掉HTML标签 * 将HTML的特殊字符转换为了HTML实体 htmlentities * 将#和%转换为他们对应的实体符号 * 加上了$length参数来限制提交 ...

  8. iOS 11系列 - Xcode 9新特性

    Xcode 9最近刚刚发布,带来了一系列不错的新特性,可以更好的帮助到开发者完成开发工作. Xcode Runtime Tool Xcode 9中有许多Runtime Tool可以帮助开发者找到代码错 ...

  9. HTML系列(3)基本的HTML标签(二)

        本节继续介绍HTML的常用标签.     (1)input标签之文本域(text和textarea).密码域(password): <!DOCTYPE html> <html ...

  10. springboot打war包

    修改pom为war不是jar. 移除tomcar的jar依赖: <dependency> <groupId>org.springframework.boot</group ...