zoukankan      html  css  js  c++  java
  • acm 2020 map 逆向输出

     1 #include <iostream>
     2 #include <map>
     3 #include <math.h>
     4 
     5 using namespace std;
     6 
     7 int main()
     8 {
     9     map<int, int> numberMap;
    10     int number, i,a,b;
    11     while (cin >> number && number != 0)
    12     {
    13         for ( i = 0; i < number; i++)
    14         {
    15             cin >> b;
    16             a = abs(b);
    17             numberMap.insert(pair<int, int>(a,b));
    18         }
    19         i = 0;
    20         for (map<int, int>::reverse_iterator num = numberMap.rbegin(); num != numberMap.rend(); num++)
    21         {
    22             if (i != numberMap.size()-1)
    23             {
    24                 cout << num->second << " ";
    25             }
    26             else
    27             {
    28                 cout << num->second << endl;
    29             }
    30             i++;
    31         }
    32         numberMap.clear();
    33     }
    34 
    35 }
  • 相关阅读:
    Minimum Sum
    Prefix and Suffix
    BBuBBBlesort!
    Wanna go back home
    The Chosen One+高精度
    一元三次方程
    文本文件比对
    nginx日志文件切割
    nginx启动脚本
    nginx
  • 原文地址:https://www.cnblogs.com/songyy/p/3514480.html
Copyright © 2011-2022 走看看