URAL - 2018 The Debut Album dp

【LLM】ms-Swift框架下SFT与GRPO协同优化的高效训练策略 本文深入探讨了ms-Swift框架下监督微调(SFT)与群组相对策略优化(GRPO)的协同训练策略,提升大型语言模型(LLM)的性能与效率。通过创新的架构设计和两阶段训练流程,结合GRPO的群组奖励估计与动态基线调整技术,显著优化了数学推理等任务的准确率。文章还分享了计算资源高效利用和参数调优的实战经验,为LLM训练提供了实用指导。 阅读详情

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 n, a, b (1 ≤ a, b ≤ 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

题意是给你n,a,b,构造一个由1和2构成的长度为n的序列,其中不能有连续a个1,和连续b个2

问有多少种这样的序列

刚开始题意看错了,一直想推公式,最后发现。。。。。。。。

dp【i】【j】表示长度为i并且第i个字符为j的序列个数                

显然j只有1和2两个取值

dp【i】【1】=sum(dp【i-k】【2】)(k<=a);

dp【i】【2】=sum(dp【i-k】【1】)(k<=b)                   

因为这个位置是2,前面只能是前一个位置是1或前一个位置是2并且前两个位置是1或者。。。。。前b-1个位置是2并且前b个位置是1

#include<bits/stdc++.h>
using namespace std;
long long dp[500005][2];
const long long mo=1e9+7;
int main()
{
    int n,a,b,i,j;
    cin>>n>>a>>b;
    dp[1][1]=dp[1][2]=1;
    dp[0][1]=dp[0][2]=1;
    for(i=2;i<=n;i++)
    {
        for(j=1;j<=a;j++)
        {
            if(i-j<0)
                break;
            dp[i][1]=(dp[i][1]+dp[i-j][2])%mo;
        }
        for(j=1;j<=b;j++)
        {
            if(i-j<0)
                break;
            dp[i][2]=(dp[i-j][1]+dp[i][2])%mo;
        }
    }
  //  cout<<dp[n][1]<<" "<<dp[n][2]<<endl;
    cout<<(dp[n][1]+dp[n][2])%mo<<endl;
    return 0;
}


自动驾驶领域自动化数据标注应用 自动驾驶领域自动化数据标注应用 1. 背景介绍 1.1 自动驾驶技术的发展 自动驾驶技术近年来取得了长足的进步,吸引了众多科技公司和传统车企的投入。自动驾驶系统需要感知周围环境、做出决策并控制车辆,是一个极具挑战的任务。其中,环境感知是自 阅读详情

相关推荐

四足机械臂避坑指南:从URDF配置到逆运动学控制的完整流程

本文为四足机械臂(Loco-Manipulation)系统开发提供了一份详实的实战避坑指南。文章深入剖析了从URDF模型配置、核心控制循环设计到逆运动学(IK)求解与奖励函数构建的完整流程,重点讲解了如何避免关节命名错误、惯性参数设置不当、IK求解不稳定等常见陷阱,并强调了利用collision_bbox等可视化工具进行高效调试的方法,旨在帮助工程师构建稳定、高效的四足机械臂控制系统。

weixin_42509507的博客 192

ural 2018 The Debut Album(dp¥)

2018. The Debut Album Time limit: 2.0 secondMemory 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”, ...

weixin_30530523的博客 179

电路板功能测试系统-FCT for PCBA

电路板功能测试系统用于电路板组件(PCBA)的功能测试(FCT),满足自动化大批量生产的要求。  ● 用户根据自己需要定义测试步骤,灵活方便  ● 适合工业自动化大批量生产应用  ● 系统测试精度高,稳定可靠   一、电路板功能测试系统概述 电路板测试过程通常由多个步骤组成,每单个步骤中需要对多个物理量(电压、电流、电阻、频率、波形等)进行测试。在每个步骤测试时

6812

URAL2018——The Debut Album(DP)

G - The Debut Album   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

我在浪里 406

LLC谐振变换器中的软开关艺术:ZVS与ZCS的协同设计

本文深入解析了LLC谐振变换器如何通过巧妙的电路设计,协同实现零电压开关(ZVS)与零电流开关(ZCS),从而大幅降低开关损耗与电磁干扰,提升电源效率。文章结合设计实战,详细阐述了谐振参数计算、器件选型及调试避坑指南,为高效、高功率密度电源设计提供了核心思路与解决方案。

weixin_29216957的博客 349

vnpy_ctp源码下载后转变为python可用的处理过程

vnpy_ctp源码下载后在window中编译使用

m0_37967652的博客 3327

Ural 2018 The Debut Album

题意:一个由’1‘,‘2’组成的长度为n的字符串,要求连续的1不超过a个,连续的2不超过b个,求满足条件的字符串的数量,答案模1e9+7; 思路:dp[i][j]表示长度为i,以j结尾,满足条件的字符串的数量; #include&lt;bits/stdc++.h&gt; using namespace std; const int Mod=1e9+7; long long dp[50005][...

题目实力吊打我,怎么能说我菜 271

在MATLAB和Simulink中设计并仿真一个智能建筑能效优化系统

智能建筑能效优化是现代建筑管理的重要组成部分,旨在通过智能化手段降低能源消耗、减少碳排放并提高居住舒适性。通过Simulink进行智能建筑能效优化仿真,可以验证控制策略的有效性、优化系统设计并降低开发成本。以下是如何在MATLAB和Simulink中设计并仿真一个智能建筑能效优化系统的详细步骤。通过上述步骤,我们成功设计并实现了基于Simulink的智能建筑能效优化仿真。该系统能够模拟复杂的建筑环境,验证能效优化策略的有效性,并通过优化设计提高建筑的能源利用效率和居住舒适性。

xiaoheshang_123的博客 138

URAL 2018. The Debut Album

传送门 题意:三个数N,A,B,你有1,2两种数字,组合成一个长为N的数列,1没有连续A个,2没有连续B个,问有几种排列方法。 思路:DP,dp[i][j]表示i个数,末尾为j的方案个数,可以由i-a(或者是b,看j是1还是2)到i的不同于j的方案个数总和转移而来。 using namespace std; const int maxn=50005,modn=1e9+7; int...

NightRaven的博客 332

C# 零基础入门知识点汇总

本文属于C#零基础入门之百识百例系列目录文章。此系列文章已经完结,欢迎大家点击文中文章链接查看详情进行学习。

陈言必行 -- Unity游戏开发领域优质博主 5348

与本地电脑PDF文档对话的PDF问答程序

紧接着,从PDF文档中提取文本,这部分代码的作用是遍历PDF文档中的每一页,并使用extract text(0方法提取每一页的文本内容,然后将这些文本内容累加到raw text变量中。PDF问答程序的实现方式是利用LangChain已实现的向量存储、嵌入,以及使用查询和检索相关的链来获取外部数据集及处理文档,在进行相关性检索后进行合并处理,将其置入大语言模型的提示模板中,实现与PDF文件交流的目的。例如,你正在为一项重要的报告寻找资料,你必须知道你需要查找的关键词,然后在大量的信息中筛选出你需要的部分。

weixin_43961909的博客 1420

URAL 2018 The Debut Album DP中滚动数组用法

题目描述:Description 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 pr

喵头鹰的博客 673

化工设计软件:AutoCAD Plant 3D二次开发_(1).AutoCADPlant3D概述

AutoCAD Plant 3D 是一款专为化工行业设计的三维工厂设计和建模软件。它基于AutoCAD平台,提供了强大的三维建模功能和专业的化工设计工具,帮助工程师和设计师在工厂设计过程中提高效率和准确性。AutoCAD Plant 3D不仅能够创建详细的三维模型,还可以进行管道设计、设备布置、支架设计等复杂任务。通过上述案例,我们可以看出 AutoCAD Plant 3D 在化工厂设计中的强大功能和优势。该软件不仅提供了丰富的建模工具和专业的设计功能,还支持二次开发,使用户能够根据具体需求进行定制化操作。

kkchenjj的博客 1102

☆URAL 2018 The Debut Album (dp 两种写法)

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 yo

K键盘里的青春K 608

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

URAL 2018 The Debut Album(DP)

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 yo

AI蜗牛之家 1318

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

Ural 2018The Debut Album(DP)

题目地址:Ural 2018 简单DP。用滚动数组。 代码如下: #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define LL __int64 const int INF

scf0920 1133

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

【DP】URAL 2018 The Debut Album

Problem Description 给你n个数,由1,2组成,连续1的个数不能超过a,连续2的个数不能超过b。 Input The only line contains integers n, a, b (1 ≤ a, b ≤ 300; max( a, b) + 1 ≤ n ≤ 50 000). Output Output the number of different record

ACMer 梁剑锋 的博客 351

URAL_2018_The Debut Album(滚动数组DP)

题型:动态规划 题意:构造长度为n的串,

Light_starlight 1237

URAL 2018 The Debut Album(dp)

题目链接 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 m

madaidao的专栏 793

G - The Debut Album URAL - 2018(dp)

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 t

DS00HY的小博客 355

ural 2018. The Debut Album 滚动数组dp

点击打开链接 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

代码改变世界,keep coding。 1368

ural 2018 The Debut Album (dp)

题意:有两个物品,两个物品连续放分别最多放a,b个,输出总共放n个的方案数 分析:考虑dp[n][p],表示最后放p,总共放n个方案数,就很简单了 #include<iostream> #include<cstdio> using namespace std; const int maxn=5e4+5; const int mod=1e9+7; ...

weixin_30294709的博客 105

URAL 2018. The Debut Album (dp)

Description 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 pr

小坏蛋_千千 688

G - The Debut Album URAL - 2018 (dp滚动数组)

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 gro...

qq_44134712的博客 208

The Debut Album URAL - 2018[滚动数组递推DP]

2018. The Debut AlbumTime limit: 2.0 secondMemory limit: 64 MBPop-group “Pink elephant” entered on recording their debut album. In fact they have only two songs: “My love” and “I miss you”, but each o...

howell 212
上一篇: 数位dp
下一篇: HDU - 5974 A Simple Math Problem 解方程
jerans
博客等级 码龄10年 54粉丝 255原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值