兴海县公司网站建设,网站怎么做框架集,深圳建设局招标网站,个人建站的app哪里有卖传送门 给你n个馅饼#xff0c;之后给出n个馅饼掉落时间和位置。一共有11个位置从 0 ~ 10#xff0c;这人初始在第5个位置#xff0c;让后每一秒最多能移动一个单位#xff0c;问这个人能最多能拿多少馅饼。
思路#xff1a; 有点像数字三角形#xff0c;但是需要逆着推…传送门 给你n个馅饼之后给出n个馅饼掉落时间和位置。一共有11个位置从 0 ~ 10这人初始在第5个位置让后每一秒最多能移动一个单位问这个人能最多能拿多少馅饼。
思路 有点像数字三角形但是需要逆着推保证没有后效性最后f[0][5]就是答案。
//#pragma GCC optimize(2)
#includecstdio
#includeiostream
#includestring
#includecstring
#includemap
#includecmath
#includecctype
#includevector
#includeset
#includequeue
#includealgorithm
#includesstream
#includectime
#includecstdlib
#define X first
#define Y second
#define L (u1)
#define R (u1|1)
#define pb push_back
#define mk make_pair
#define Mid (tr[u].ltr[u].r1)
#define Len(u) (tr[u].r-tr[u].l1)
#define random(a,b) ((a)rand()%((b)-(a)1))
#define db puts(---)
using namespace std;void rd_cre() { freopen(d://dp//data.txt,w,stdout); srand(time(NULL)); }
void rd_ac() { freopen(d://dp//data.txt,r,stdin); freopen(d://dp//AC.txt,w,stdout); }
void rd_wa() { freopen(d://dp//data.txt,r,stdin); freopen(d://dp//WA.txt,w,stdout); }typedef long long LL;
typedef unsigned long long ULL;
typedef pairint,int PII;const int N100010,mod1e97,INF0x3f3f3f3f;
const double eps1e-6;int n,x,t;
int f[N][11];int main()
{
// ios::sync_with_stdio(false);
// cin.tie(0);while(scanf(%d,n)!EOFn){int mx0;memset(f,0,sizeof(f));for(int i1;in;i){int x,t; scanf(%d%d,x,t);f[t][x]; mxmax(mx,t);}for(int imx;i0;i--)for(int j0;j10;j) f[i][j]max(f[i1][j],max(f[i1][max(j-1,0)],f[i1][min(j1,10)]));printf(%d\n,f[0][5]);}return 0;
}
/**/