由于下午硬钢树套树和大力颓废就没补完

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的更多相关文章

  1. Codeforces Round #539 div2

    Codeforces Round #539 div2 abstract I 离散化三连 sort(pos.begin(), pos.end()); pos.erase(unique(pos.begin ...

  2. 【前行】◇第3站◇ Codeforces Round #512 Div2

    [第3站]Codeforces Round #512 Div2 第三题莫名卡半天……一堆细节没处理,改一个发现还有一个……然后就炸了,罚了一啪啦时间 Rating又掉了……但是没什么,比上一次好多了: ...

  3. Codeforces Round#320 Div2 解题报告

    Codeforces Round#320 Div2 先做个标题党,骗骗访问量,结束后再来写咯. codeforces 579A Raising Bacteria codeforces 579B Fin ...

  4. Codeforces Round #564(div2)

    Codeforces Round #564(div2) 本来以为是送分场,结果成了送命场. 菜是原罪 A SB题,上来读不懂题就交WA了一发,代码就不粘了 B 简单构造 很明显,\(n*n\)的矩阵可 ...

  5. Codeforces Round #361 div2

    ProblemA(Codeforces Round 689A): 题意: 给一个手势, 问这个手势是否是唯一. 思路: 暴力, 模拟将这个手势上下左右移动一次看是否还在键盘上即可. 代码: #incl ...

  6. Codeforces Round #626 Div2 D,E

    比赛链接: Codeforces Round #626 (Div. 2, based on Moscow Open Olympiad in Informatics) D.Present 题意: 给定大 ...

  7. CodeForces Round 192 Div2

    This is the first time I took part in Codeforces Competition.The only felt is that my IQ was contemp ...

  8. Codeforces Round #359 div2

    Problem_A(CodeForces 686A): 题意: \[ 有n个输入, +\space d_i代表冰淇淋数目增加d_i个, -\space d_i表示某个孩纸需要d_i个, 如果你现在手里 ...

  9. Codeforces Round #360 div2

    Problem_A(CodeForces 688A): 题意: 有d天, n个人.如果这n个人同时出现, 那么你就赢不了他们所有的人, 除此之外, 你可以赢他们所有到场的人. 到场人数为0也算赢. 现 ...

随机推荐

  1. datetimebox赋值或取值

    datetimebox赋值或取值 $('#j_dateStart').datebox('setValue', ""); //赋予空值 $("#j_dateStart&qu ...

  2. php第二十七节课

    注册审核 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3 ...

  3. 字符串--P1308 统计单词数

    题目描述 一般的文本编辑器都有查找单词的功能,该功能可以快速定位特定单词在文章中的位置,有的还能统计出特定单词在文章中出现的次数. 现在,请你编程实现这一功能,具体要求是:给定一个单词,请你输出它在给 ...

  4. Multisim破解教程

    转载:http://www.121down.com/article/article_52879.html

  5. 日期工具类 DateTools

    为了跟其他日期工具类进行区分起名字DateTools public class DateTools { /** The DAT e_ forma t1. */ public static String ...

  6. 【06】AngularJS 控制器

    AngularJS 控制器 AngularJS 控制器 控制 AngularJS 应用程序的数据. AngularJS 控制器是常规的 JavaScript 对象. AngularJS 控制器 Ang ...

  7. 转载 - C - 枚举类型详解

    出处:http://www.cnblogs.com/JCSU/articles/1299051.html 注:以下全部代码的执行环境为VC++ 6.0 在程序中,可能需要为某些整数定义一个别名,我们可 ...

  8. scrapy的User-Agent中间件、代理IP中间件、cookies设置、多个爬虫自定义settings设置

    在scrapy的反爬中,常用的几个配置,简单总结了下: User-Agent中间件: from fake_useragent import UserAgent class RandomUserAgen ...

  9. Cocoa -- 添加和移除开机启动项

    一 写plist到~/Library/LaunchAgents/ 目录下 // 配置开机默认启动 -(void)installDaemon{ NSString* launchFolder = [NSS ...

  10. Regular Number 字符串匹配算法 Shift_and

    Using regular expression to define a numeric string is a very common thing. Generally, use the shape ...