Hdu:2020 绝对值排序
来源:互联网 发布:淘宝卖自己做的食品 编辑:程序博客网 时间:2024/05/16 18:57
#include <iostream>#include <algorithm>using namespace std;int input[105];int ab[105];int temp[105];int index[105];int cmp(int a,int b){ return (a>b);}int main(){ int n; while(cin>>n&&n>0) { for(int i=0;i<n;i++) { cin>>input[i]; if(input[i]>0||input[i]==0) { ab[i]=input[i]; temp[i]=input[i]; } else { ab[i]=-input[i]; temp[i]=-input[i]; } } sort(temp,temp+n,cmp); for(int i=0;i<n;i++) for(int j=0;j<n;j++) { if(temp[i]==ab[j]) { index[i]=j; break; } } for(int i=0;i<n-1;i++) cout<<input[index[i]]<<" "; cout<<input[index[n-1]]<<endl; }}
阅读全文
0 0
- HDU 2020 绝对值排序
- HDU 2020 绝对值排序
- HDU 2020 绝对值排序
- HDU,2020,绝对值排序
- HDU 2020 绝对值排序
- HDU 2020 绝对值排序
- hdu 2020 绝对值排序
- HDU 2020 绝对值排序
- [hdu 2020] 绝对值排序
- HDU 2020 绝对值排序
- HDU 2020 绝对值排序
- hdu 2020 绝对值排序
- hdu--2020 绝对值排序
- HDU 2020 绝对值排序
- hdu 2020 绝对值排序
- HDU 2020 -- 绝对值排序
- HDU 2020 绝对值排序
- 绝对值排序 HDU 2020
- 文字颜色随机变换
- 使用EF从数据库表直接创建类
- 计算机网络:TCP与UDP(一)
- tomcat源码中Digester解析
- 洛谷 P1081开车旅行
- Hdu:2020 绝对值排序
- Apache的php版本配置
- 仿函数
- 奋斗群赛事---2, 初出茅庐
- 大灰狼玩Scala--简介---(1)
- poj 1463 Strategic game 树形dp
- VMware12 + CentOS7 安装
- 精彩博客
- 鼠标滑上选择文本