#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>

using namespace std;
bool cmp(int a, int b) {
    return abs(a) > abs(b);
}

int main() {
    int n;
    ) {
        vector<int> v;
        int t;
        ;i < n;i++) {
            cin >> t;
            v.push_back(t);
        }
        sort(v.begin(), v.end(), cmp);
        for (auto it = v.begin();it != v.end();it++) {
            if (it == v.begin()) cout << *it;
            else cout << " " << *it;
        }
        cout << endl;
    }

    ;
}

HDOJ 2020 绝对值排序的更多相关文章

  1. HDU 2020 绝对值排序

    http://acm.hdu.edu.cn/showproblem.php?pid=2020 Problem Description 输入n(n<=100)个整数,按照绝对值从大到小排序后输出. ...

  2. HDOJ2020绝对值排序

    绝对值排序 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submi ...

  3. (qsort)绝对值排序

    绝对值排序 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Subm ...

  4. 【ACM】hdu_zs3_1003_绝对值排序_201308100742

    绝对值排序 Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other)Total Submissi ...

  5. 【ACM】hdu_2020_绝对值排序_201308050929

    绝对值排序 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submi ...

  6. HDU2020——绝对值排序(java实现,使用map)

    Question Description Input Output Sample Input Sample Output 解题思路简述: 在接收每一个数组的过程中,将负数及其绝对值以键值对的形式存入m ...

  7. HDU_2020——按绝对值排序

    Problem Description 输入n(n<=100)个整数,按照绝对值从大到小排序后输出.题目保证对于每一个测试实例,所有的数的绝对值都不相等.   Input 输入数据有多组,每组占 ...

  8. UVA 11039-Building designing【贪心+绝对值排序】

    UVA11039-Building designing Time limit: 3.000 seconds An architect wants to design a very high build ...

  9. ACM_绝对值排序

    Why Males And Females Apart? Time Limit: 2000/1000ms (Java/Others) Problem Description: In so many o ...

随机推荐

  1. Ubuntu下一个好用的终端

    在终端下输入: sudo apt-get install terminator 快捷键: shift+ctrl+e          在当前窗口右侧新开一个窗口 shift+ctrl+w        ...

  2. 基本数据类型,数字int字符串str

    基本数据类型 数字 int 字符串 str 布尔值 bool 列表 list 字典 dict 元组 tuple(待续...) 整数 int - 创建 a = 123 a = int(123) - 转换 ...

  3. Ubuntu下安装JDK图文教程详解 jdk-java6-30 .bin 的处理方法

    Ubuntu下安装JDK图文教程详解 jdk-java6-30 .bin 的处理方法: https://blog.csdn.net/mingjie1212/article/details/485250 ...

  4. python3 sort

    #https://docs.python.org/3.5/howto/sorting.html?highlight=sort #In Python 3.2, the functools.cmp_to_ ...

  5. redux笔记1

    1.安装redux  使用  npm install -save redux  安装redux,注意使用-save 表示安装到依赖中: 2. 创建store文件夹,下面创建 index.js 和 re ...

  6. 手把手教你用MATLAB画灰度直方图

    hist =[1,2,3,4,5,6,7,8,7,6,5,4,3,2,1]     %15个元素      这个行矩阵(数组)输入到命令行 bar(hist) 用列矩阵也行 hist_im=imhis ...

  7. Go语言实战 (William,Kennedy 等著)

    第1章 关于Go语言的介绍 (已看) 1.1 用Go解决现代编程难题 1.1.1 开发速度 1.1.2 并发 1. goroutine 2. 通道 1.1.3 Go语言的类型系统 1. 类型简单 2. ...

  8. Bow & Arrow 学习

    using UnityEngine; using System.Collections; using System.Collections.Generic; using UnityEngine.UI; ...

  9. IntelliJ IDEA使用心得

    前言:我原来一直使用的是Eclipse,但是发现有的教程上使用的是Intellij这个IDE,而且我发现Eclipse在Web编程上特别是页面上的自动补全上确实有些不足,而且Intellij这个软件的 ...

  10. 3个问题:MySQL 中 character set 与 collation 的理解;utf8_general_ci 与 utf8_unicode_ci 区别;uft8mb4 默认collation:utf8mb4_0900_ai_ci 的含义

    MySQL 中 character set 与 collation 的理解 出处:https://www.cnblogs.com/EasonJim/p/8128196.html 推荐: 编码使用 uf ...