1 solutions
-
0
构造排序
#include<bits/stdc++.h> using namespace std; int a[110]; bool cmp(int x,int y) { if(abs(x)>abs(y))return true; else return false; } int main() { ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); int n;cin>>n; for(int i=1;i<=n;++i)cin>>a[i]; sort(a+1,a+1+n,cmp); for(int i=1;i<=n;++i)cout<<a[i]<<' '; return 0; }
Information
- ID
- 4140
- Time
- 1000ms
- Memory
- 64MiB
- Difficulty
- 10
- Tags
- # Submissions
- 1
- Accepted
- 1
- Uploaded By