bzoj1679
来源:互联网 发布:淘宝美工速成教程 编辑:程序博客网 时间:2024/05/17 06:26
刷水题提高自信
#include<bits/stdc++.h>using namespace std;#define FOR(i,s,t) for(int i=(s);i<=(t);i++)inline int read(void){ int x = 0, c, f = 1; do{c=getchar();if(c=='-')f=-1;}while(c<'0'||c>'9'); do{x=x*10+c-'0';c=getchar();}while(c>='0'&&c<='9'); return x * f;}typedef long long LL;const int N = 11000;int a[N];int n;int main() { n = read(); for (int i = 1; i <= n; i++) a[i] = read(); sort(a + 1, a + n + 1); LL sum = a[1], tot = 0; for (int i = 2; i <= n; i++) { tot += (LL) a[i] * (i - 1) - sum; sum += a[i]; } cout << 2 * tot << endl;}
阅读全文
0 0
- bzoj1679
- bzoj1679[Usaco2005 Jan]Moo Volume 牛的呼声
- windows server2008 创建新用户 远程桌面连接 和 多用户登录问题
- 华为手机调试没有LOG解决方案
- 联合体(union)的使用方法及其本质
- Linux下MySQL5.7.18二进制包安装(无默认配置文件my_default.cnf)
- 关闭Angularjs对HTML标签自动转义
- bzoj1679
- Java菜鸟面试突破系列Java集合源码解读系列:HashMap实现原理
- cocoa pods的安装与我遇到的问题
- JS内置对象、函数内置对象、宿主对象
- Access denied for user 'root'@'localhost' (using password: YES)
- Json字符串转函数代码
- C++接口,纯虚函数,抽象类的关系
- 游戏蜂窝研究--全局的异常捕获器
- ConcurrentModificationException解决方案