cf 1009E

曾经终败给现在 2021-10-25 12:56 350阅读 0赞

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

  1. #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; }

转载于:https://www.cnblogs.com/MXang/p/11355587.html

发表评论

表情:
评论列表 (有 0 条评论,350人围观)

还没有评论,来说两句吧...

相关阅读

    相关 cf 1009E

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