数据太坑了呜呜呜呜呜呜呜呜呜呜呜呜呜呜呜呜呜呜呜呜
查看原帖
数据太坑了呜呜呜呜呜呜呜呜呜呜呜呜呜呜呜呜呜呜呜呜
766454
hiYE_ame楼主2024/1/21 15:47
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int t,m,a,b,f[10100];
int main(){
    cin>>t>>m;
    for(int i=0;i<m;i++){
        cin>>a>>b;
        for(int j=t-1;j>a;j--){
            f[j]=max(f[j],f[j-a]+b);
        }
    }
    cout<<f[t-1]<<endl;
    return 0;
}
2024/1/21 15:47
加载中...