摘要:
#include<bits/stdc++.h> using namespace std; int n,m; const int INF=0x3f3f3f3f; const int MAXN=110; bool vis[MAXN]; int lowc[MAXN]; int tu[MAXN][MAXN] 阅读全文
摘要:
#include<bits/stdc++.h> using namespace std; const int maxn=1010; const int inf=0x3f3f3f3f; int n,m; struct node{ int v,w; node(){ } node(int _v,int _ 阅读全文
摘要:
#include<bits/stdc++.h> using namespace std; int n,m; struct node{//结构体 int v,w; node(){ }; node(int _v,int _w){ v=_v; w=_w; } }; vector <node> g[1010 阅读全文
摘要:
配合__int128使用 inline int read() { char c = getchar(); int x = 0, f = 1; while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();} while(c >= '0' 阅读全文
摘要:
考虑用dp的做法,容易想到价格低的物品一定要比价格高的物品拿的优先级高,所以排序。 dp[i]表示取前i件物品需要的最少价格,当超越了价格,就不算。 转移方程为 dp[i]=min(dp[i-1]+a[i],dp[i-k]+a[i]) 表示当前物品单独买和买一送一的情况; 取最小值。 上代码 #in 阅读全文