首页 > 其他 > 详细

cf 1009E

时间:2019-08-15 09:11:06      阅读:59      评论:0      收藏:0      [点我收藏+]

如何看待某cf2000分选手不会一道tag1900的题?
难。
考虑每段距离的贡献,
a[i]出现在位置j上,当且仅当j-i休息,并且中间的都不是休息的。

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 998244353;
int n;ll a[1000005],bas[1000005],dp[1000005];
ll ans;
int main(){
    ios::sync_with_stdio(false);
    cin>>n;bas[0]=1;
    for(int i=1;i<=n;i++)cin>>a[i],bas[i]=bas[i-1]*2%mod;
    for(int i=1;i<=n;i++){
        (ans+=a[i]*(bas[n-i]+bas[n-i-1]*(n-i)%mod)%mod)%=mod;
    }
    cout<<ans<<endl;
}

cf 1009E

原文:https://www.cnblogs.com/MXang/p/11355587.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!