hdu6092(留以纪念)
来源:互联网 发布:lv羊绒围巾 知乎 编辑:程序博客网 时间:2024/06/05 00:28
As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them:
Yuta has
Now, Yuta has got
Yuta shows Rikka the array
It is too difficult for Rikka. Can you help her?
For each testcase, the first line contains two numbers
The second line contains
It is guaranteed that there exists at least one solution. And if there are different solutions, print the lexicographic minimum one.
22 31 1 1 13 31 3 3 1
1 21 1 1
留个纪念
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
int mm[10005];
int la[10005],ans[55];
long long a[10005];
using namespace std;
int main()
{
int t,n,m;
cin>>t;
while(t--)
{
scanf("%d %d",&n,&m);
for(int i=0;i<=m;i++)
{
scanf("%lld",&a[i]);
}
memset(la,0,sizeof(la));
la[0]=1;
for(int i=1;i<=n;i++)
{
int k=1;
while(a[k]==0)
k++;
ans[i]=k;
for(int j=m;j>=0;j--)
{
if(j+k<=m)
{
la[j+k]+=la[j];
a[j+k]-=la[j];
}
}
}
for(int i=1;i<n;i++)
printf("%d ",ans[i]);
printf("%d\n",ans[n]);
}
return 0;
}
- hdu6092(留以纪念)
- HDU6092
- hdu6092
- 发文以示纪念
- 自己记录,以作纪念。
- 我的设计灵魂终于有了自己的栖息地,留文以纪念!
- Blog开通,发贴以作纪念!
- 开张大吉,发发贴,以表纪念
- 截图以留作第五十题纪念!
- HDU6092(动态规划思想)
- HDU6092 子集问题
- HDU6092 Rikka with Subset
- HDU6092(83/600)
- HDU6092-Rikka with Subset
- hdu6092 Rikka with Subset
- HDU6092(Rikka with Subset)
- HDU6092(有趣的数学题)
- HDU6092-Rikka with Subset
- Scala入门学习笔记【list练习题】
- 【HDU3652】B-number
- DOM
- LightOJ 1422 Halloween Costumes
- 2017西安集训总结
- hdu6092(留以纪念)
- php+mysql事务处理例子详细分析实例
- 佳佳的魔法照片
- Battle City(bfs)
- 如何用注册表删除Win10桌面上的顽固IE图标
- 很有用的cv牛人的网址和主要贡献
- 丑数
- JQuery DOM元素的删除和添加
- 【转载】cad .net二次开发调试方法