绝对值排序解题报告
2013-02-22 14:26
197 查看
原题:点击题目链接
分析:水题一枚,不解释;
水神一个,难题不会~
源码:
分析:水题一枚,不解释;
水神一个,难题不会~
源码:
#include<stdio.h> #include<math.h> #include<iostream> #include<algorithm> using namespace std; struct N { int a; int b; }p[101]; int cmp(N g,N h) { return g.b>h.b; } int main() { int n; while(scanf("%d",&n)&&(n!=0)) { for(int i=0;i<n;i++) { scanf("%d",&p[i].a); } for(int j=0;j<n;j++) { p[j].b=fabs(p[j].a); } sort(p,p+n,cmp); for(int f=0;f<n-1;f++) { printf("%d ",p[f].a); } printf("%d\n",p[n-1].a); } return 0; }
相关文章推荐
- 绝对值排序解题报告
- (解题报告)HDU2020---绝对值排序
- CUGBACM11级专题训练之排序解题报告
- 【九度OJ】题目1054:字符串内排序 解题报告
- Only_排序 解题报告汇总
- 剑指Offer解题报告(Java版)——排序数组中某个数的个数 38
- 【九度OJ】题目1185:特殊排序 解题报告
- 解题报告:POJ_1833 排序
- hdu 1106 - 排序(解题报告)
- hdu_2000_ASCII码排序_解题报告
- BZOJ 5071 [Lydsy 十月月赛] 排序 解题报告
- hdu_2003_求绝对值_解题报告
- hdoj 2000 ASCII码排序 用java写的解题报告
- (解题报告)POJ3664---Election Time---用结构体实现两组相关联数据的排序问题
- 一中OJ #1151 [USACO Jan08] 化妆晚会 | 排序与查找 | 解题报告
- Leetcode 451. Sort Characters By Frequency 按频率对字符排序 解题报告
- hdu_2003_求绝对值_解题报告
- 【九度OJ】题目1202:排序 解题报告
- 杭电OJ题 1106 排序 解题报告
- 【九度OJ】题目1190:大整数排序 解题报告