link:http://codeforces.com/contest/347/problem/A

开始看起来很复杂的样子,但是刚写下样例,就发现因为中间的都消去了,其实起作用的就是最大值和最小值=_=

 #include <cstdio>
 #include <algorithm>
 using namespace std;
 ];
 int main(void)
 {
 #ifndef ONLINE_JUDGE
     freopen("in.txt", "r", stdin);
 #endif
     int n;
     while (~scanf("%d", &n))
     {
         int i;
         ; i < n; scanf("%d", a+i++));
         sort(a, a+n);
         printf(]);
         ; i < n-; ++i)
             printf(" %d", a[i]);
         printf(]);
     }
     ;
 }

排序后输出就行。

codeforces A. Difference Row的更多相关文章

  1. codeforces A. Difference Row 解题报告

    题目链接:http://codeforces.com/problemset/problem/347/A 题目意思:给出一个序列 a1, a2, ..., an , 通过重排序列,假设变成 x1, x2 ...

  2. CodeForces 347A Difference Row (水题)

    题意:给定 n 个数,让你找出一个排列满足每个数相邻作差之和最大,并且要求字典序最小. 析:这个表达式很简单,就是把重新组合一下,就成了x1-xn,那么很简单,x1是最大的,xn是最小的,中间排序就好 ...

  3. codeforces 347A - Difference Row

    给你一个序列,让你求(x1 - x2) + (x2 - x3) + ... + (xn - 1 - xn).值最大的一个序列,我们化简一下公式就会发现(x1 - x2) + (x2 - x3) + . ...

  4. A. Difference Row

    A. Difference Row time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  5. codeforces round #201 Div2 A. Difference Row

    #include <iostream> #include <vector> #include <algorithm> using namespace std; in ...

  6. RGB 颜色空间转 HSI 颜色空间的matlab程序实现

    RGB 颜色空间转 HSI 颜色空间的matlab程序实现 2014.10.20之前的内容有误,这里依据wikipedia更新了算法内容. 算法以wiki为准 https://en.wikipedia ...

  7. Educational Codeforces Round 6 C. Pearls in a Row

    Educational Codeforces Round 6 C. Pearls in a Row 题意:一个3e5范围的序列:要你分成最多数量的子序列,其中子序列必须是只有两个数相同, 其余的数只能 ...

  8. Codeforces 903D Almost Difference

    Codeforces 903D Almost Difference time limit per test 2 seconds memory limit per test 256 megabytes ...

  9. Codeforces gym101612 L.Little Difference(枚举+二分)

    传送:http://codeforces.com/gym/101612 题意:给定一个数n(<=1e18),将n分解为若干个数的成绩.要求这些数两两之间的差值不能大于1. 分析: 若n==2^k ...

随机推荐

  1. C++自学计划

    课程描述 课程名称:C++远征之起航篇&C++远征之离港篇 授课人姓名:james_yuan 课程链接地址 C++远征之起航篇 C++远征之离港篇 章节列表 选择理由 一开始在自己比较熟悉的网 ...

  2. 多线程下的for循环问题

    List<int> _ValueLis = new List<int>(); private void AddInt(int i) { _ValueLis.Add(i); } ...

  3. JavaScript贷款计算器

    今天花了两个小时模仿书上代码用JS制作了JavaScript贷款计算器,时间有些长,但相比以前,自己细心了不少,每天进步一点点,量的积累达到质的飞跃 <!doctype html>< ...

  4. flex页面刷新实现

    页面刷新:navigateToURL(new URLRequest("javascript:location.reload();"),"_self"); 关闭浏 ...

  5. C/C++程序员常去网站

    www.codeproject.comwww.codegru.comwww.chinaunix.netwww.csdn.netwww.vckbase.com http://www.google.com ...

  6. 关于lwip移植到ucsos-ii平台的遇到的问题(一)

    移植的步骤参照<Day_Day_Up笔记之uCOS-II_LwIP_在_STM32F107_上移植>,<uCOS平台下的LwIP移植笔记>,<嵌入式网络那些事>. ...

  7. java1234初学maven

    第一讲: maven maven是基于项目对象模型(POM),可以通过一小段描述信息来管理项目的构建,报告和文档的软件项目管理工具. maven安装与下载: .确定jdk已经安装并且配置 .安装mav ...

  8. js③

    while(true){ console.log('hello'); }/每次执行完语句块之后,又会跳回去检查小括号里面的布尔值,如果为true,那么又会执行语句块一次. //while循环//var ...

  9. SharePoint Framework 概述

    博客地址:http://blog.csdn.net/FoxDave 本文翻译自新出的SharePoint Framework概述介绍文章,原文地址:http://dev.office.com/sh ...

  10. Learning in Two-Player Matrix Games

    3.2 Nash Equilibria in Two-Player Matrix Games For a two-player matrix game, we can set up a matrix ...