‘Young, have you ever tasted the loneliness walking in dark path; have you ever run about madly just to avoid the pain in the deep heart?'
After BiYao's death, XiaoFan changed to GuiLi .Running in such darkness, leaving the rain wet out his clothes, leaving the darkness cover up his eyes, he will never regret!
Now, we separate the path into n parts with the same length (1<=N<=1000).Every part has its value Ai (-1000<=Ai<=1000). If Xiaofan walks through the ith part of the path, he will get the hurt Ai. His trump ShaoHuoGun will give him S chances to fly (1<=S<=100). Every chance can help him get through one part of the path without any hurt. But there’s a limit: The length of his fly Si should be longer than La and shorter than Lb (1<=La<=Si<=Lb<=n).
Your job is to find the best way for XiaoFan to have the least hurt.
Hit: Two different fly paths can't cover each other, and times of fly can be fewer than the given times S.
10 3 2 3 3 1 -5 -9 2 -1 1 -7 9 10 10 4 3 4 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0
-21 -10
//
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=1010;
int f[maxn][maxn];//f[i][j]表示在位置i飞行次数为j时的最小伤害
int a[maxn];//在i处受到的伤害
int sum[maxn];
int n,la,lb,s;
int main()
{
while(scanf("%d",&n)==1&&n)
{
scanf("%d%d%d",&lb,&la,&s);
for(int i=1;i<=n;i++)
{
scanf("%d",&a[i]);
sum[i]=sum[i-1]+a[i];
}
for(int i=1;i<=n;i++) f[i][0]=sum[i];
//可用单调队列优化 减少为1维
for(int i=1;i<=n;i++)
{
for(int j=1;j<=s;j++)
{
f[i][j]=f[i-1][j]+a[i];
for(int k=la;k<=lb&&i-k>=0;k++)
{
f[i][j]=min(f[i][j],f[i-k][j-1]);
}
}
}
int ans=(1<<28);
for(int i=0;i<=s;i++) ans=min(ans,f[n][i]);
printf("%d\n",ans);
}
return 0;
}
本文深入探讨了游戏开发领域的关键技术,包括游戏引擎、编程语言、硬件优化等,并结合AI音视频处理技术,展示如何在游戏场景中应用这些技术提升用户体验和效率。
598

被折叠的 条评论
为什么被折叠?



