codeforces Ilya and Matrix
http://codeforces.com/contest/313/problem/C
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
long long a[]; int main()
{
int n;
scanf("%d",&n);
for(int i=; i<n; i++)
{
scanf("%lld",&a[i]);
}
sort(a,a+n);
long long ans=,ans1=;
int k=,j=;
for(int i=n-; i>=; i--)
{
ans1+=a[i];
j++;
if(j==k)
{
ans+=ans1;
k=k*;
}
}
printf("%lld\n",ans);
return ;
}
codeforces Ilya and Matrix的更多相关文章
- CodeForces 313C Ilya and Matrix
Ilya and Matrix Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Su ...
- codeforces C. Ilya and Matrix 解题报告
题目链接:http://codeforces.com/problemset/problem/313/C 题目意思:给定 4n 个整数(可以组成 2n × 2n 大小的矩阵),问通过对这些整数进行排列, ...
- Codeforces 549H. Degenerate Matrix 二分
二分绝对值,推断是否存在对应的矩阵 H. Degenerate Matrix time limit per test 1 second memory limit per test 256 megaby ...
- Codeforces 1102F Elongated Matrix 状压dp
Elongated Matrix 预处理一下两两之间的最小值, 然后直接dp. #include<bits/stdc++.h> #define LL long long #define f ...
- Codeforces 632F Magic Matrix(bitset)
题目链接 Magic Matrix 考虑第三个条件,如果不符合的话说明$a[i][k] < a[i][j]$ 或 $a[j][k] < a[i][j]$ 于是我们把所有的$(a[i][j ...
- Codeforces Gym101341I:Matrix God(随机化构造矩阵降维)***
http://codeforces.com/gym/101341/problem/I 题意:给三个N*N的矩阵,问a*b是否等于c. 思路:之前遇到过差不多的题目,当时是随机行(点),然后验证,不满足 ...
- codeforces 632F. Magic Matrix (最小生成树)
You're given a matrix A of size n × n. Let's call the matrix with nonnegative elements magic if it i ...
- codeforces 632F. Magic Matrix
题目链接 给一个n*n的矩阵, 问是否对角线上的元素全都为0, a[i][j]是否等于a[j][i], a[i][j]是否小于等于max(a[i][k], a[j][k]), k为任意值. 前两个都好 ...
- 【Codeforces 364A】Matrix
[链接] 我是链接,点我呀:) [题意] 让你求出b[i][j]=s[i]*s[j]规则构成的矩阵 的所有子矩阵中子矩阵的和为a的子矩阵的个数 [题解] (x,y,z,t) 会发现它的和就是sum(x ...
随机推荐
- SDL2.0 学习笔记-1 windows下的第一个测试程序
SDL全称是Simple DirectMedia Layer,是一个开源的.跨平台(win32,linux,mac)的多媒体开发c语言库. 官方网站 http://www.libsdl.org/ 第一 ...
- 日期函数(SqlServer)
1.常用日期方法(下面的GetDate() = '2006-11-08 13:37:56.233') (1)DATENAME ( datepart ,date ) 返回表示指定日期的指定日期部分的字符 ...
- PHP发送POST请求的三种方式
class Request{ public static function post($url, $post_data = '', $timeout = 5){//curl $ch = curl_in ...
- js中的循环语句
js中的循环语句可分为三种:1.while:2.do……while:3.for. while的语法为 while (exp) { //statements;} var a=1,b=0; whil ...
- 1030 - Image Is Everything (贪心)
Your new company is building a robot that can hold small lightweight objects. The robot will have th ...
- Js中执行变量中的命令语句,也就是所谓的宏替换(很实用的例子)
Js中执行变量中的命令语句,也就是所谓的宏替换(很实用的例子) 由其做动态编程时非常有用,必须符合js中的语法,用eval能够执行. var aaa="alert('这是变量中的语句')&q ...
- POJ 2455Secret Milking Machine(二分+网络流之最大流)
题目地址:POJ2455 手残真浪费时间啊..又拖到了今天才找出了错误..每晚两道题不知不觉又变回了每晚一道题...sad.. 第一次在isap中忘记调用bfs,第二次则是遍历的时候竟然是从1開始遍历 ...
- jsPlumb开发入门教程(实现html5拖拽连线)
jsPlumb是一个强大的JavaScript连线库,它可以将html中的元素用箭头.曲线.直线等连接起来,适用于开发Web上的图表.建模工具等.它同时支持jQuery+jQuery UI.MooTo ...
- 使用Ksoap2调用Web Service加入SoapHeader
关于这个问题,如果使用百度都是前篇一律的代码,好不容易上了google才找到完整的方法,这里讲所有的代码都贴出来与大家分享. 首先是.NET写的后台代码 /// <summary> /// ...
- centos7启动时出现“无法应用原保存的显示器配置”
设置了分辨率后,登录提示“出现无法应用原保存的显示器配置”. 解决办法: 打开终端,输入 rm ~/.config/monitors.xml 然后重新登录, 问题解决.