题目链接:http://codeforces.com/contest/1009/problem/E

解题心得:

#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6+;
const long long MOD = ;
typedef long long ll;
ll num[maxn], pow2[maxn];
ll n; void get_pow2(){
pow2[] = ;
for(int i=;i<=n;i++)
pow2[i] = (pow2[i-] * ) % MOD;
} void init() {
scanf("%lld",&n);
for(ll i=;i<=n;i++) {
scanf("%lld",&num[i]);
}
get_pow2();
} void solve(){
ll ans = ;
for(ll i=;i<=n;i++){
ll temp;
if(i == n)
temp = ;
else
temp = pow2[n-i] + pow2[n-i-]*(n-i);
temp %= MOD;
ans += temp*num[i];
ans %= MOD;
}
printf("%lld\n",ans);
} int main() {
init();
solve();
return ;
}

Educational Codeforces Round 47 (Rated for Div. 2) :E. Intercity Travelling的更多相关文章

  1. Educational Codeforces Round 47 (Rated for Div. 2) :D. Relatively Prime Graph

    题目链接:http://codeforces.com/contest/1009/problem/D 解题心得: 题意就是给你n个点编号1-n,要你建立m条无向边在两个互质的点之间,最后所有点形成一个连 ...

  2. Educational Codeforces Round 47 (Rated for Div. 2) :C. Annoying Present(等差求和)

    题目链接:http://codeforces.com/contest/1009/problem/C 解题心得: 题意就是一个初始全为0长度为n的数列,m此操作,每次给你两个数x.d,你需要在数列中选一 ...

  3. Educational Codeforces Round 47 (Rated for Div. 2) :B. Minimum Ternary String

    题目链接:http://codeforces.com/contest/1009/problem/B 解题心得: 题意就是给你一个只包含012三个字符的字符串,位置并且逻辑相邻的字符可以相互交换位置,就 ...

  4. Educational Codeforces Round 47 (Rated for Div. 2) :A. Game Shopping

    题目链接:http://codeforces.com/contest/1009/problem/A 解题心得: 题意就是给你两个数列c,a,你需要从c中选择一个子串从a头开始匹配,要求子串中的连续的前 ...

  5. Educational Codeforces Round 47 (Rated for Div. 2) 题解

    题目链接:http://codeforces.com/contest/1009 A. Game Shopping 题目: 题意:有n件物品,你又m个钱包,每件物品的价格为ai,每个钱包里的前为bi.你 ...

  6. Educational Codeforces Round 55 (Rated for Div. 2):E. Increasing Frequency

    E. Increasing Frequency 题目链接:https://codeforces.com/contest/1082/problem/E 题意: 给出n个数以及一个c,现在可以对一个区间上 ...

  7. Educational Codeforces Round 55 (Rated for Div. 2):D. Maximum Diameter Graph

    D. Maximum Diameter Graph 题目链接:https://codeforces.com/contest/1082/problem/D 题意: 给出n个点的最大入度数,要求添加边构成 ...

  8. Educational Codeforces Round 55 (Rated for Div. 2):C. Multi-Subject Competition

    C. Multi-Subject Competition 题目链接:https://codeforces.com/contest/1082/problem/C 题意: 给出n个信息,每个信息包含专业编 ...

  9. Educational Codeforces Round 47 (Rated for Div. 2)E.Intercity Travelling

    题目链接 大意:一段旅途长度N,中间可能存在N-1个休息站,连续走k长度时,疲劳值为a1+a2+...+aka_1+a_2+...+a_ka1​+a2​+...+ak​,休息后a1a_1a1​开始计, ...

随机推荐

  1. tdf sample

    using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net ...

  2. NO.007-2018.02.12《白头吟》两汉:卓文君

    白头吟_古诗文网_解析_鉴赏_赏析 白头吟 两汉:卓文君 白头吟:乐府<楚调曲>调名.据<西京杂记>卷三载,蜀地巨商卓王孙的女儿卓文君,聪明美丽,有文采,通音乐.孀居在家时,与 ...

  3. 【[TJOI2017]城市】

    题目 好像\(noip\)之前做某雅礼的题的时候看到过这道题的数据范围增强版 当时那道题数据范围是\(3e5\)感觉神仙的一批 这道题数据范围\(5e3\)那岂不是可以\(O(n^2)\)水过 有一点 ...

  4. 【[HNOI2011]数学作业】

    我又对着跑出正解的程序调了好久 怕不是眼瞎了 这就是个分段矩阵,我们很容易就得到了递推式 $\(f[i]=f[i-1]*10^k+i\) 其中\(k=log_{10}i\) 于是就是分段矩阵 之后就是 ...

  5. POJ3737 UmBasketella

    嘟嘟嘟 一道三分入门题. 参考二分,三分就是每一次把区间分成三段,然后舍弃一段,不断缩小范围直到一个点. 一般用于求单峰函数的最值问题. 这道题发现V和r成一次函数的关系,因此三分r. 下面给出三分板 ...

  6. 2018.11.12 Spring事务的实现和原理

    Spring事务用法示例与实现原理 关于事务,简单来说,就是为了保证数据完整性而存在的一种工具,其主要有四大特性:原子性.一致性.隔离性和持久性.对于Spring事务,其最终还是在数据库层面实现的,而 ...

  7. SyncUI跨设备同步

    SynUI控制代码 <script type="text/javascript"> /* SyncUI script (Learn more at http://syn ...

  8. checkbox 全选

    <template> <div class="hello"> <table> <tr> <th><input ty ...

  9. ZLG zigbee 虚拟串口配置

    一.设置网关工作模式: 在ZNetCom Utility工具中,将设置网关工作模式为 Real COM 模式 启动 ZNetCom Utility 搜索设备 获得设备信息 修改工作模式为:real c ...

  10. Failed to introspect bean class [org.springframework.orm.hibernate5.LocalSessionFactoryBean] for lookup method metadata: could not find class that it depends on; nested exception is java.lang.NoClass

    依赖引入  错误可能版本 不对 Failed to introspect bean class [org.springframework.orm.hibernate5.LocalSessionFact ...