max函数里a和b都改为long long
by 2022_37_yzyUUU @ 2023-11-08 21:33:27
这样真可以AC
[this](https://www.luogu.com.cn/record/134053597)
by 2022_37_yzyUUU @ 2023-11-08 21:34:57
@[sususu_123](/user/974547) 蒟蒻太蒻了导致理解不了 `long long int` 是什么意思
by heyx0201 @ 2023-11-08 21:35:07
@[sususu_123](/user/974547) 真没见过这么开变量的
by heyx0201 @ 2023-11-08 21:37:02
@[heyx0201](/user/768951) 其实也没问题,一般跟longlong一样,不过因为比longlong多打个int所以用的人少而已
by suyulong1212 @ 2023-11-08 21:40:31
@[suyulong1212](/user/275790) 涨姿势了,%%%
by heyx0201 @ 2023-11-08 21:45:55
@[2022_37_yzyUU](/user/785636) thanks
by sususu_123 @ 2023-11-08 21:56:11
over,已悟
by sususu_123 @ 2023-11-08 21:56:58
亲测,CPP100pts
贴代码
```cpp
#include<bits/stdc++.h>
#define MAX (9223372036854775807)
using namespace std;
typedef long long ll;
ll t,n,_time[100005],v[100005],f[10000005];
int main()
{
cin>>t>>n;
for(int i=1;i<=n;i++)
{
cin>>_time[i]>>v[i];
}
for(int i=1;i<=n;i++)
{
for(int j=_time[i];j<=t;j++)
{
f[j]=max(f[j],f[j-_time[i]]+v[i]);
}
}
cout<<f[t]<<"\n";
return 0;
}
```
应该差不多
by zhangxisu @ 2023-11-18 20:18:26