codeforces round #415 div2
由于下午硬钢树套树和大力颓废就没补完
C:我傻逼比赛时没做出来。。。就是排个序然后算贡献
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = , mod = ;
int n;
ll ans, t = ;
ll a[N], bin[N];
bool cp(int i, int j) { return i < j; }
int main()
{
scanf("%d", &n);
bin[] = ;
for(int i = ; i <= n; ++i)
{
scanf("%lld", &a[i]);
t = t * 2ll % mod;
bin[i] = (bin[i - ] + t) % mod;
}
sort(a + , a + n + , cp);
for(int i = ; i <= n; ++i)
ans = (ans + a[i] % mod * bin[i - ] % mod) % mod;
for(int i = n - ; i; --i)
ans = ((ans - a[i] % mod * bin[n - i - ] % mod) % mod + mod) % mod;
printf("%lld\n", ans);
return ;
}
codeforces round #415 div2的更多相关文章
- Codeforces Round #539 div2
Codeforces Round #539 div2 abstract I 离散化三连 sort(pos.begin(), pos.end()); pos.erase(unique(pos.begin ...
- 【前行】◇第3站◇ Codeforces Round #512 Div2
[第3站]Codeforces Round #512 Div2 第三题莫名卡半天……一堆细节没处理,改一个发现还有一个……然后就炸了,罚了一啪啦时间 Rating又掉了……但是没什么,比上一次好多了: ...
- Codeforces Round#320 Div2 解题报告
Codeforces Round#320 Div2 先做个标题党,骗骗访问量,结束后再来写咯. codeforces 579A Raising Bacteria codeforces 579B Fin ...
- Codeforces Round #564(div2)
Codeforces Round #564(div2) 本来以为是送分场,结果成了送命场. 菜是原罪 A SB题,上来读不懂题就交WA了一发,代码就不粘了 B 简单构造 很明显,\(n*n\)的矩阵可 ...
- Codeforces Round #361 div2
ProblemA(Codeforces Round 689A): 题意: 给一个手势, 问这个手势是否是唯一. 思路: 暴力, 模拟将这个手势上下左右移动一次看是否还在键盘上即可. 代码: #incl ...
- Codeforces Round #626 Div2 D,E
比赛链接: Codeforces Round #626 (Div. 2, based on Moscow Open Olympiad in Informatics) D.Present 题意: 给定大 ...
- CodeForces Round 192 Div2
This is the first time I took part in Codeforces Competition.The only felt is that my IQ was contemp ...
- Codeforces Round #359 div2
Problem_A(CodeForces 686A): 题意: \[ 有n个输入, +\space d_i代表冰淇淋数目增加d_i个, -\space d_i表示某个孩纸需要d_i个, 如果你现在手里 ...
- Codeforces Round #360 div2
Problem_A(CodeForces 688A): 题意: 有d天, n个人.如果这n个人同时出现, 那么你就赢不了他们所有的人, 除此之外, 你可以赢他们所有到场的人. 到场人数为0也算赢. 现 ...
随机推荐
- vue的自定义指令控制菜单权限
用户登录后,选择子节点,节点中含有多个菜单,可以根据后台返回的权限数据进行权限控制 在vue上挂载自定义指令方法,根据后台返回权限移除相应节点 import Cookies from "js ...
- 【LeetCode】9、Palindrome Number(回文数)
题目等级:Easy 题目描述: Determine whether an integer is a palindrome. An integer is a palindrome when it rea ...
- springcloud(九):熔断器Hystrix和Feign的应用案例
因为 feign 中已经支持了 Hystrix ,所以在 Feign 中使用 Hystrix 时,不需要导包,也不需要在入口类上面增加额外的注解: Feign 虽然支持了 Hystrix ,但是默认 ...
- Apache Maven Cookbook(一)maven 使用命令创建、编译java项目
一.创建 使用命令创建项目分几步: 1.打开命令行窗口,比如cmd,把目录切换至想要创建项目地方. 2.执行如下命令: mvn archetype:generate -DgroupId=com.zua ...
- BNUOJ 5966 Rank of Tetris
Rank of Tetris Time Limit: 1000ms Memory Limit: 32768KB This problem will be judged on HDU. Original ...
- zoj 3768 Continuous Login
Pierre is recently obsessed with an online game. To encourage users to log in, this game will give u ...
- JAVA NIO 之NIO简介
复习NIO知识,权当做笔记~~ 在NIO之前先复习一下 1.I/O类简图 2.通常我们把网络通信也归到IO行为中,例如网络编程中的scoket通信. 不管是磁盘I/O,还是网络I/O,数据在写入Ou ...
- Jupyter Notebook: 解决build docker-stacks时conda太慢的问题
当想使用docker安装Jupyter Notebook时,有一个很好的项目是docker-stacks(https://github.com/jupyter/docker-stacks/tree/m ...
- Install nginx-clojure on CentOS 7
Install nginx-clojure on CentOS 7 1. install open-jdk-7 sudo yum install java-1.7.0-openjdk-devel 2. ...
- HDU 1973
Prime Path Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total ...