Description
有两棵苹果树(编号为1和2),每分钟这两棵树中就会有一棵掉苹果下来
最开始你站在1号树下,并且忽略移动的时间,问你最多移动W(1<=W<=30)次
问你最多可接到多少苹果
Input
第1行:由空格隔开的两个整数:T和W
第2..T+1行:1或2(每分钟掉落苹果的树的编号)
Output
如题
Samples
输入数据 1
7 2
2
1
1
2
2
1
1
Copy
输出数据 1
6
思路
首先,申明一下,这道题实在是太水了,我好不容易才找到一道这么水的dp题。
这道题的思路也非常简单,那么也不需要讲了,直接看代码。
#include<bits/stdc++.h>
using namespace std;
int d=1e7,wl[]={9,2,5,5,4,5,6,3,7,6};
int f[501][501][201];
int z[100000],sd,g[100000],o[100000],uss[501][501],q;
int n,m,mo=1e9+7;
int s=10;
int sf=1,sg=s,sh=-1313333,tt=9e8,l,k;
char