bryce1010模板

http://codeforces.com/gym/101810

#include<bits/stdc++.h>
using namespace std; #define ll long long const ll maxn = 1e5 + 5;
const ll mod = 1e9+7; ll n;
ll p[maxn];
ll vis[maxn]; int main()
{
ll t;
scanf("%lld",&t);
ll pre;
while(t--)
{
scanf("%lld",&n);
pre = 1;
for(int i=1;i<=n;i++)
{
scanf("%lld",&p[i]);
} fill(vis,vis+1+n,1);
for(int i=1;i<=n;i++)
{
vis[i] = pre*vis[i]%mod;
pre = p[i]*pre%mod;
}
vis[0] = n*pre%mod;
pre = 1;
for(int i=n;i>=1;i--)
{
vis[i] = pre*vis[i]%mod;
pre = p[i]*pre%mod;
} ll ans = vis[0];
for(int i=1;i<=n;i++)
{
ans = (mod+ans-vis[i])%mod;
}
printf("%lld\n",ans);
}
return 0;
}

Gym - 101810E ACM International Collegiate Programming Contest (2018)的更多相关文章

  1. Gym - 101810H ACM International Collegiate Programming Contest (2018)

    bryce1010模板 http://codeforces.com/gym/101810 #include <bits/stdc++.h> using namespace std; #de ...

  2. Gym - 101810F ACM International Collegiate Programming Contest (2018)

    bryce1010模板 http://codeforces.com/gym/101810 #include<bits/stdc++.h> using namespace std; #def ...

  3. Gym - 101810D ACM International Collegiate Programming Contest (2018)

    bryce1010模板 http://codeforces.com/gym/101810 #include <bits/stdc++.h> using namespace std; #de ...

  4. Gym - 101810C ACM International Collegiate Programming Contest (2018)

    bryce1010模板 http://codeforces.com/gym/101810 #include <bits/stdc++.h> using namespace std; #de ...

  5. Gym - 101810B ACM International Collegiate Programming Contest (2018)

    bryce1010模板 http://codeforces.com/gym/101810 #include <bits/stdc++.h> using namespace std; #de ...

  6. Gym - 101810A ACM International Collegiate Programming Contest (2018)

    bryce1010模板 http://codeforces.com/gym/101810/problem/A 大模拟,写崩了,代码借队友的...... 注意处理段与段的连接问题: #include&l ...

  7. ACM International Collegiate Programming Contest, Tishreen Collegiate Programming Contest (2018) Syria, Lattakia, Tishreen University, April, 30, 2018

    ACM International Collegiate Programming Contest, Tishreen Collegiate Programming Contest (2018) Syr ...

  8. ACM International Collegiate Programming Contest World Finals 2014

    ACM International Collegiate Programming Contest World Finals 2014 A - Baggage 题目描述:有\(2n\)个字符摆在编号为\ ...

  9. ACM International Collegiate Programming Contest World Finals 2013

    ACM International Collegiate Programming Contest World Finals 2013 A - Self-Assembly 题目描述:给出\(n\)个正方 ...

随机推荐

  1. [RK3288][Android6.0] 调试笔记 --- eMMC分区号和名字的对应【转】

    本文转载自:http://blog.csdn.net/kris_fei/article/details/77318410 Platform: Rockchip OS: Android 6.0 Kern ...

  2. 自动化测试框架selenium+java+TestNG——配置篇

    最近来总结下自动化测试 selenium的一些常用框架测试搭配,由简入繁,最简单的就是selenium+java+TestNG了,因为我用的是java,就只是总结下java了. TestNG在线安装: ...

  3. word使用技巧

    word文档左侧显示目录 word2007  选择word的视图,然后选择文档结构图 word中插入当前文档名称或者文档编辑时间 https://stackoverflow.com/questions ...

  4. fatal error C1902: 程序数据库管理器不匹配;请检查安装解决

    http://blog.sina.com.cn/s/blog_9f4bc8e301015uhz.html 1.错误提示:VS2008编译错误fatal error C1902: 程序数据库管理器不匹配 ...

  5. BZOJ 1628 [Usaco2007 Demo]City skyline:单调栈

    题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1628 题意: 题解: 单调栈. 单调性: 栈内元素高度递增. 一旦出现比栈顶小的元素,则表 ...

  6. 数学题--On Sum of Fractions

    题目链接 题目意思: 定义v(n)是不超过n的最大素数, u(n)是大于n的最小素数. 以分数形式"p/q"输出 sigma(i = 2 to n) (1 / (v(i)*u(i) ...

  7. Subset Sums

    链接 分析:dp[i][j]表示前i个数能够组成j的对数,可得dp[i][j]=dp[i-1][j]+dp[i-1][j-i],所以最后dp[n][sum/2]既是所求 /* PROB:subset ...

  8. [ZJOI 2012] 网络

    [题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=2816 [算法] 对每种颜色的边建一棵LCT , 维护联通性即可 时间复杂度 : O( ...

  9. JAVA 需要理解的重点 一

    需要理解的重点内容有: JVM内存管理机制和垃圾回收机制(基本每次面试都会问,一定要搞得透彻) JVM内存调优(了解是怎么回事,一般做项目过程中使用较多) 设计模式(熟悉常见设计模式的应用场景,会画类 ...

  10. eclipse的工程里的*.properties文件默认以unicode的编码形式显示

    今天发现导入eclipse的工程里的*.properties文件无法显示中文,是unicode的编码形式显示的. 原因是Eclipse的.properties文件的默认编码为iso-8859-1. 选 ...