build shop

building shop

题意:有n个教室,要在n个教室中建一些糖果屋,第i个教室建糖果屋的花费ci,不建糖果屋的教室的花费是此教室左边离它最近的糖果屋与他的距离。

思路:类似于01背包,dp[i][1]表示前i个教室第i个教室建糖果屋的最小花费,则dp[i][1]=min(dp[i-1][0],dp[i-1][1])+c[i];

dp[i][0]表示前i个教室第i个教室不建糖果屋的最小花费,则需要找到它左边的糖果屋,可以枚举离教室i的超市j的位置,然后取所有情况的最小值就可以了。

还有一个优化是防止超时的,

如何记录教室j+1~教室i的费用的和

ans+=(i-j)*(no[j+1].pos-no[j].pos);

如 x1 x2 x3

i=3,

j=2时 ans=x3-x2

j=1时 x3-x1+x2-x1=x3-x2+2*x2-2*x1=ans+(3-1)*(x2-x1)

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf=999999999999;
struct node
{
    ll pos,c;
};
node no[3010];
bool cmp(node a,node b)
{
    return a.pos<b.pos;
}
int main()
{
   ll dp[3010][2],i,j,l,n;
   while(~scanf("%lld\n",&n))
   {
       for(i=1;i<=n;i++)
       {
           scanf("%lld%lld",&no[i].pos,&no[i].c);
       }
       sort(no+1,no+1+n,cmp);
       memset(dp,0,sizeof(dp));
       dp[1][1]=no[1].c;
       dp[1][0]=inf;
       for(i=2;i<=n;i++)
       {
           dp[i][1]=min(dp[i-1][1],dp[i-1][0])+no[i].c;//cout<<dp[i][1]<<"!"<<endl;
            dp[i][0]=inf;
            ll ans=0;
           for(j=i-1;j>=1;j--)
           {   /*ll ans=0;
               for(l=i;l>j;l--)
               {
                   ans+=no[l].pos-no[j].pos;//cout<<ans<<"!!"<<endl;
               }TLE*/
               ans+=(i-j)*(no[j+1].pos-no[j].pos);
               dp[i][0]=min(dp[i][0],dp[j][1]+ans);
               //cout<<dp[i][0]<<"!!!"<<endl;
           }
       }
       printf("%lld\n",min(dp[n][0],dp[n][1]));
   }
}
//人一我百,人百我万
//时间

### Photoshop on Windows 11 Installation and Usage Guide For installing Adobe Photoshop on a Windows 11 system, one should follow an approach similar to that of installing software packages where installers function akin to wizards seen in other applications; typically this involves double-clicking the installer file—be it .exe or another format—and following the on-screen instructions which generally entail clicking "Next" several times until setup concludes[^1]. #### Pre-installation Requirements Before initiating the installation process for Photoshop on Windows 11, ensure that all prerequisites are met including having sufficient disk space available as well as ensuring compatibility with your version of Windows. #### Downloading Photoshop Installer To obtain the latest stable build of Photoshop compatible with Windows 11, visit the official Adobe website. Subscription through Creative Cloud grants access not only to Photoshop but also integrates seamlessly into Microsoft’s newer operating systems like Windows 11. #### Installing Photoshop Once downloaded, launch the installer by double-clicking its icon. The graphical user interface will guide users step-by-step throughout the entire procedure without requiring advanced technical knowledge from end-users. ```powershell # Example PowerShell command to check installed apps (not specific to Photoshop) Get-Object { $_.Name -like "*Adobe*" } ``` #### Using Photoshop Effectively After successful deployment, launching Photoshop can be done via Start Menu search bar simply typing 'Photoshop'. Upon opening, tutorials within Help menu provide guidance covering basic operations up to more complex features aiding both beginners and professionals alike. --related questions-- 1. What are some common troubleshooting steps when encountering issues during Photoshop installation? 2. How does one optimize performance settings specifically tailored towards running graphic-intensive programs such as Photoshop on Windows 11? 3. Can you recommend any resources for learning advanced techniques using Photoshop effectively after mastering basics? 4. Is there support for additional languages beyond English in the application locale properties found inside JavaScript APIs used by certain extensions? 5. Are there alternative viewers or editors comparable to MuPDF recommended officially outside repositories meant primarily for developer contributions?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值