#include
int main ()
{
int a[11] = {-5, -9, -87, 65, -6, 83, 27, -35, -46, 100, 0};
int b[101] = {0};
int c[101] = {0};
int n[10] = {0};
int step = 0;
for (int i = 0; i
if (a[i]
c[-a[i]]++;
else
b[a[i]]++;
for (int i = 101; i > 0; i--)
while (c[i]--)
n[step++] = 0-i;
}
while (b[i]--)
n[step++] = i;
printf ("%d\n", n[i]);
return 0;
// 想不到什麼好的辦法.....
#include
int main ()
{
int a[11] = {-5, -9, -87, 65, -6, 83, 27, -35, -46, 100, 0};
int b[101] = {0};
int c[101] = {0};
int n[10] = {0};
int step = 0;
for (int i = 0; i
if (a[i]
c[-a[i]]++;
else
b[a[i]]++;
for (int i = 101; i > 0; i--)
{
while (c[i]--)
n[step++] = 0-i;
}
for (int i = 0; i
{
while (b[i]--)
n[step++] = i;
}
for (int i = 0; i
printf ("%d\n", n[i]);
return 0;
}
// 想不到什麼好的辦法.....