离谱……
查看原帖
离谱……
1050501
ATION001楼主2024/7/6 11:23

#43 在本地上没过,CF上过了

测试点

1 1
1 1
99

代码

#include<bits/stdc++.h>
using namespace std;
int c,d,n,m,k,dp[10005],tot,ans=1e9;
void code(int v,int w){
    for(int i=v;i<=tot;i++){
        dp[i]=min(dp[i],dp[i-v]+w);
    }
}
int main(){
    fill(dp+1,dp+10005,1e9);
    cin>>c>>d>>n>>m>>k;
    tot=n*m;
    code(n,c),code(1,d);
    for(int i=tot-k;i<=tot;i++){
        ans=min(ans,dp[i]);
    }
    cout<<ans;
    return 0;
}

然后在vjudge上又没过了……QAQ

2024/7/6 11:23
加载中...