自己逗比了,题意的子序列没注意,,一直想不出。。。
然后看了别人的,,
有种不知从怎么理解最好-1
http://blog.csdn.net/yitongjun/article/details/54620176
这种的比较好理解
参考http://www.bubuko.com/infodetail-1917198.html
int a[mxn];
LL dp[mxn][2];
int main(){
// freopen("in.txt","r",stdin);
freopen("azerah.in","r",stdin);
freopen("azerah.out","w",stdout);
int T;sf("%d",&T);
while(T--){
int n;sf("%d",&n);mem(dp,0);
rep(i,1,n){ sf("%d",&a[i]);a[i]=a[i]&1; }
if(a[1]%2)dp[1][1]=1;
else dp[1][0]=1;
for(int i=2;i<=n;++i){
if(a[i]){
dp[i][1]=(dp[i-1][1]+dp[i-1][0]+1)%mod;
dp[i][0]=(dp[i-1][1]+dp[i-1][0])%mod;
}
else{
dp[i][1]=(dp[i-1][1]*2)%mod;
dp[i][0]=(dp[i-1][0]*2+1)%mod;
}
}
pf("%d\n",dp[n][0]);
}
}
https://vjudge.net/contest/177686#problem/L
手残了。。。自己还是能过的,,不过看别人的思路更好。、
http://blog.csdn.net/harlow_cheng/article/details/54844966
https://vjudge.net/contest/177686#problem/K (区间dp|| 模拟贪心)
参考这个的,和别人的代码。。
http://www.cnblogs.com/TreeDream/p/6322755.html
我的代码好丑结果,连最基本的地方的算法都错了。
没办法,再做还是错。。算了。。 (就是一种细节提吧。。)
多校五:
https://vjudge.net/contest/177506#problem/F
大概的规律感觉到了,但是思维有点乱,没敲好。。。
https://vjudge.net/contest/177506#problem/H
还说是签到题。。
这个背包还是看不太懂啊。。。
放着吧。。