acm 2020 map 逆向输出

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 }
acm 2020 map 逆向输出

acm 2020 map 逆向输出

上一篇:This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its de 错误解决办法


下一篇:中老年衣服