标签:info pac tps print for href std algorithm idt
https://www.luogu.com.cn/problem/P1616
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; int f[10000002], v[10002], w[10002]; int main() { int t, m; scanf("%d%d", &t, &m); for (int i = 1; i <= m; i++) scanf("%d%d", &w[i], &v[i]); for (int i = 1; i <= m; i++) for (int j = w[i]; j <= t; j++) f[j] = max(f[j], f[j - w[i]] + v[i]); printf("%d", f[t]); }
标签:info pac tps print for href std algorithm idt
原文地址:https://www.cnblogs.com/Jason66661010/p/13121643.html