📄 usaco_inflate.cpp
字号:
/*
ID: wangyuc2
PROG: inflate
LANG: C++
*/
#include <fstream>
#include <iostream>
#include <cmath>
#include <memory>
#include <iomanip>
#define cin fin
using namespace std;
ifstream fin("inflate.in");
ofstream fout("inflate.out");
long int bag[10005];
int m,n;
int main()
{
int i,j,k,points,time;
cin>>m>>n;
for(i=0;i<n;i++)
{ cin>>points>>time;
for(j=time;j<=m;j++)
if(bag[j-time]+points > bag[j]) bag[j]=bag[j-time]+points;
}
fout<<bag[m]<<endl;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -