| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 365971 | 余逸凡 | 【C5-8】正负排序 | C++ | Accepted | 100 | 6 MS | 252 KB | 327 | 2025-12-06 10:09:20 |
#include<iostream> #include<algorithm> using namespace std; bool cmp(int x,int y){ if(x*y<0) return x<y; if(x>0&&y>0) return x>y; return x<y; } int main(){ int n,a[105]; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } sort(a+1,a+n+1,cmp); for(int i=1;i<=n;i++){ cout<<a[i]<<" "; } return 0; }